Apress

Mac Programming for Absolute Beginners

By Wallace Wang

Mac Programming for Absolute Beginners Cover Image

Jump into the world of Mac programming with best-selling author Wallace Wang.

Full Description

  • ISBN13: 978-1-4302-3336-7
  • 416 Pages
  • User Level: Beginner
  • Publication Date: January 20, 2011
  • Available eBook Formats: EPUB, MOBI, PDF
  • Print Book Price: $39.99
  • eBook Price: $27.99
Buy eBook Buy Print Book Add to Wishlist

Related Titles

Full Description

Want to learn how to program on your Mac? Not sure where to begin? Best-selling author Wallace Wang will explain how to get started with Cocoa, Objective-C, and Xcode. Whether you are an experienced Windows coder moving to the Mac, or you are completely new to programming, you’ll see how the basic design of a Mac OS X program works, how Objective-C differs from other languages you may have used, and how to use the Xcode development environment. Most importantly, you’ll learn how to use elements of the Cocoa framework to create windows, store data, and respond to users in your own Mac programs. If you want to learn how to develop apps with Cocoa, Objective-C, and Xcode, this book is a great first step.

Here are just a few of the things you’ll master along the way:

  • Fundamental programming concepts aided by short, easy-to-understand examples
  • How to use Xcode and related programming tools to save time and work more efficiently
  • A firm understanding of the basics of Objective-C and how it compares to other languages you might know
  • How to create simple apps using the Cocoa framework
  • How to easily design, write, test, and market your finished program
With this book and your trusty Mac, you’re well on your way to transforming your Mac app ideas into real applications.

What you’ll learn

  • Basic programming concepts illustrated with short, easy-to-understand examples
  • How to use Xcode and related programming tools
  • The basics of Objective-C and how it compares to other languages you might know
  • How to create simple apps using the Cocoa framework

Who this book is for

Mac users who want to learn programming or Windows developers who are moving to the Mac OS and iOS platforms. No previous programming experience required.

Table of Contents

Table of Contents

  1. Understanding Programming
  2. Understanding Apple’s Programming Tools
  3. The Basic Steps to Creating a Mac Program
  4. Getting Help
  5. Learning Objective-C
  6. Making Decisions with Branches
  7. Repeating Code with Loops
  8. Understanding the Cocoa Framework
  9. Manipulating Strings
  10. Arrays
  11. Dictionaries and Sets
  12. Creating Classes and Objects
  13. Inheritance, Method Overriding, and Events
  14. Creating a User Interface
  15. Choosing Commands with Buttons
  16. Making Choices with Radio Buttons and Check Boxes
  17. Making Choices with Pop-Up Buttons
  18. Inputting and Outputting Data with Labels, Text Fields, and Combo Boxes
  19. Inputting Data with Sliders, Date Pickers, and Steppers
  20. Using Built-In Dialog Boxes
  21. Creating Pull-Down Menus
  22. Designing Your Own Programs
  23. Working with Xcode
  24. Debugging Your Program
Source Code/Downloads

Downloads are available to accompany this book.

Your operating system can likely extract zipped downloads automatically, but you may require software such as WinZip for PC, or StuffIt on a Mac.

Errata

If you think that you've found an error in this book, please let us know about it. You will find any confirmed erratum below, so you can check if your concern has already been addressed.

* Required Fields

On page Chapter 3 epub:
In chapter 3 in the epub-book under "Creating an Action Method" following lines missing a space:

@property (assign) IBOutletNSWindow *window;
@property (assign) IBOutletNSTextField *message;

Should be:

@property (assign) IBOutlet NSWindow *window;
@property (assign) IBOutlet NSTextField *message;

Its ok in the PDF-version on page: 39

Have checked in two epub softwares.

On page Chapter 3 epub:
Missing space in epub-version at following lines under "An Advanced Interactive User Interface Example":

@property (assign) IBOutletNSWindow *window;
@property (assign) IBOutletNSTextField *message;
@property (assign) IBOutletNSTextField *inputData;

Sholud be:

@property (assign) IBOutlet NSWindow *window;
@property (assign) IBOutlet NSTextField *message;
@property (assign) IBOutlet NSTextField *inputData;


Ok in PDF-version in page 43

On page 34-36:
I installed the latest version of xcode and am having trouble following the first example that connects a text field and a button. The book asks me to edit a source file but there are already differences between what I have in xcode and what I see in the book (for the sections that I'm not supposed to edit).

I have xcode 4.2.1 if that helps. Will these examples run on that version of xcode?

On page 68:
Center of page, last sentence of first paragraph under "Defining Compiler Directives..."

"The most common compiler directive appears in front of the import keyword:"

The element that appears in front of the import keyword is the # sign, which certainly is very common, but not itself a compiler directive. The sentence should probably read "The most common compiler directive is import:".

Or perhaps better, "... #import:" - in conjunction with some re-wording of the preceding sentence, as follows:

"...sometimes you may need to give the compiler special instructions. These are called directives and are identified by a leading # sign. The most common is #import:"

(Which also avoids explicitly misidentifying the directive as a compiler directive. It's splitting hairs, I know, but technically #import is a preprocessor directive; compiler directives have a leading @ sign. See Appendix A in Apple's Objective-C Programming Language manual.)

On page 81:
Center of page

"For leaving comments... you use the // and /* and */ symbols for multiple lines."

This implies that you use all of those ("...// and /* and */...") for multiple lines.

Better: "...you use // for single lines, and /* and */ for multiple lines."

On page 187:

page 187, first line:

-(void)displayMessage: (NSString *) myName count:(int)myLoop;
{

I think that the ";" must not be there.

On page 376:
Note at bottom of page

("[Cmd]" in the following represents the Command key symbol)

"...press [Cmd]+/ (in other words, press the Command key followed by the + key followed by the / key)"

That will not work - the plus sign is not part of the keyboard shortcut sequence.

At a minimum, the words "followed by the + key" should be removed from the clarification. Better yet, change the wording to "...hold down the Command key and press the / key", because "...followed by..." can be taken to mean that the keys can be pressed and released one after the other. That works for ALT sequences in Windows, but this is not the ALT key. Or Windows.

Also, for consistency (see examples at the top of the page and elsewhere), change "[Cmd]+/" to "[Cmd]/".