Learn Objective-C on the Mac: For OS X and iOS, 2/e (Paperback)

Scott Knaster



Learn to write apps for some of today's hottest technologies, including the iPhone and iPad (using iOS), as well as the Mac (using OS X). It starts with Objective-C, the base language on which the native iOS software development kit (SDK) and the OS X are based. Learn Objective-C on the Mac: For OS X and iOS, Second Edition updates a best selling book and is an extensive, newly updated guide to Objective-C.

Objective-C is a powerful, object-oriented extension of C, making this update the perfect follow-up to Dave Mark’s bestselling Learn C on the Mac. Whether you’re an experienced C programmer or you’re coming from a different language such as C++ or Java, leading Mac experts Scott Knaster and Waqar Malik show how to harness the power of Objective-C in your apps!

  • A complete course on the basics of Objective-C using Apple’s newest Xcode tools
  • An introduction to object-oriented programming
  • Comprehensive coverage of new topics like blocks, GCD, ARC, class extensions, as well as inheritance, composition, object initialization, categories, protocols, memory management, and organizing source files
  • An introduction to building user interfaces using what is called the UIKit
  • A primer for non-C programmers to get off the ground even faster

What you’ll learn

  • Learn Objective-C programming, the gateway to programming your iPhone, iPad or Mac
  • Write apps for the iOS and/or OS X interfaces, the cleanest user-interfaces around
  • Understand variables and how to design your own data structures
  • Work with the new Objective-C features now available in this update like blocks, automated reference counting (ARC) and class extensions
  • Work with new tools available like Clang static analyzer and Grand Central Dispatch (GCD)
  • Undertand UIKit and how to build simple user interfaces easily and effectively
  • Explore using the latest Xcode

Who this book is for

For anyone wanting to learn to program native apps in iOS and/or OS X, including developers new to the iOS-based iPhone and iPad as well as OS X-based Mac computers. This book is for developers new to Objective-C, but who have some programming experience.

Table of Contents

  1. Hello 
  2. Extensions to C
  3. Introduction to Object-Oriented Programming
  4. Inheritance
  5. Composition
  6. Source File Organization and Using Xcode 4
  7. More About Xcode
  8. A Quick Tour of the Foundation Kit
  9. Memory Management and ARC
  10. Object Initialization
  11. Properties
  12. Categories
  13. Protocols
  14. Blocks and Concurrency
  15. Introduction to UIKit
  16. Introduction to the Application Kit
  17. File Loading and Saving
  18. Key-Value Coding
  19. Using the Static Analyzer
  20. NSPredicate
Appendix: Coming from Other Languages


學習編寫一些當今最熱門的技術應用程式,包括使用iOS的iPhone和iPad,以及使用OS X的Mac。它從Objective-C開始,這是原生iOS軟體開發工具包(SDK)和OS X所基於的基礎語言。《在Mac上學習Objective-C:針對OS X和iOS,第二版》是一本暢銷書的更新版本,是一本全面且新近更新的Objective-C指南。

Objective-C是C的強大的面向對象擴展,使得這次更新成為Dave Mark暢銷書《在Mac上學習C》的完美續集。無論您是一位有經驗的C程序員,還是從C++或Java等其他語言轉過來的,領先的Mac專家Scott Knaster和Waqar Malik將展示如何在您的應用程式中利用Objective-C的威力!

  • 使用蘋果最新的Xcode工具完整學習Objective-C的基礎知識

  • 介紹面向對象編程

  • 全面涵蓋新主題,如blocks、GCD、ARC、class extensions,以及繼承、組合、對象初始化、類別、協議、內存管理和組織源文件

  • 介紹使用所謂的UIKit構建用戶界面

  • 為非C程序員提供更快速入門指南


  • 學習Objective-C編程,這是編寫iPhone、iPad或Mac應用程式的入門

  • 編寫iOS和/或OS X界面的應用程式,這是最乾淨的用戶界面

  • 了解變量以及如何設計自己的數據結構

  • 使用此更新中提供的新Objective-C功能,如blocks、自動引用計數(ARC)和類擴展

  • 使用Clang靜態分析器和Grand Central Dispatch(GCD)等新工具

  • 了解UIKit以及如何輕鬆有效地構建簡單的用戶界面

  • 探索使用最新的Xcode


適合任何想要學習在iOS和/或OS X上編寫原生應用程式的人,包括對基於iOS的iPhone和iPad以及基於OS X的Mac電腦新手開發者。本書適合對Objective-C新手,但具有一些編程經驗的讀者。


  1. Hello

  2. C的擴展

  3. 面向對象編程入門

  4. 繼承

  5. 組合

  6. 源文件組織和使用Xcode 4

  7. 更多關於Xcode

  8. Foundation Kit快速導覽

  9. 內存管理和ARC

  10. 對象初始化

  11. 屬性

  12. 類別

  13. 協議

  14. blocks和並發

  15. UIKit入門

  16. Application Kit入門

  17. 文件加載和保存

  18. Key-Value Coding

  19. 使用靜態分析器

  20. NSPredicate