iOS 4编程Cookbook(影印版)
Vandad Nahavandipoor
出版时间:2011年06月
页数:617
你能够在iOS平台上创建各种令人赞叹的应用——而且每一种应用都解决了不同的问题。通过本书的案例,你将不再停留在理论阶段,而是着手解决各种你在为iPhone、iPad和iPod touch编写应用时很有可能面临的令人烦恼的现实问题。每个案例都提供了清晰的解决方案和你可以直接使用的示例代码。
你将会在本书中找到如何使用iOS SDK 4的开发框架和诸如Cocoa、Objective-C、XCode和Interface Builder等技术。无论你对iOS开发的了解有多少,你都会从本书找到你在开发过程中每个阶段——从初始的构思阶段到项目完成——所希望获得的帮助。

· 使用Objective-C类、对象、属性、代理和内存管理
· 使用手势识别器构造用户接口
· 使用Map Kit和Core Location API开发位置感知应用
· 创建能够播放音频和视频、管理日历和事件、访问联系人和群组或者面向照片库的应用
· 使用Core Motion框架访问加速度计和陀螺仪
· 使用Core Data框架维护iOS应用的持久存储
· 创建多任务应用,用户可以离开和回到这个应用而不会丢失他们的位置信息

“这是为那些严格的iOS编程员准备的终极工具,它将变革你如何基于Objective-C编程。”
——Sushil Shirke,iOS开发人员,Monitise plc

本书作者Vandad Nahavandipoor是伦敦的一家具有全球领先的移动支付解决方案公司的工作人员。他与世界最大的几家品牌(包括Visa和US银行)一起合作过客户服务移动应用。Vandad已经有多年用Cocoa、Cocoa Touch、Assembly、Delphi和
.NET开发软件的经验。
  1. Preface
  2. 1. Working with Objects
  3. 1.1 Implementing and Using Custom Objects
  4. 1.2 Allocating and Initializing Objects
  5. 1.3 Defining Two or More Methods with the Same Name
  6. in an Object
  7. 1.4 Defining and Accessing Properties
  8. 1.5 Managing Properties Manually
  9. 1.6 Reusing a Block of Code
  10. 1.7 Communicating with Objects
  11. 1.8 Invoking the Selectors of an Object Dynamically
  12. 1.9 Managing Memory with the iOS SDK
  13. 1.10 Managing Untyped Objects
  14. 2. Implementing Controllers and Views
  15. 2.1 Getting and Using the Application Delegate
  16. 2.2 Managing the Views in Your Application
  17. 2.3 Creating Your Application’s GUI
  18. 2.4 Making Your View Controller Available at Runtime
  19. 2.5 Using a View in Your Application’s GUI
  20. 2.6 Managing Master-Detail Views
  21. 2.7 Managing Multiple Views
  22. 2.8 Incorporating and Using Models in the GUI
  23. 2.9 Implementing Navigation Bars
  24. 2.10 Switching from One View to Another
  25. 2.11 Setting the Title on a Navigation Bar
  26. 2.12 Displaying an Image for the Title of the Navigation Bar
  27. 2.13 Creating and Managing Buttons on a Navigation Bar
  28. 2.14 Removing a View from a Navigation Controller
  29. 2.15 Manipulating a Navigation Controller’s Array of
  30. View Controllers
  31. 2.16 Incorporating a Tab Bar into Your Application
  32. 2.17 Pop Up Additional Information over iPad UI Elements
  33. 3. Constructing and Using Table Views
  34. 3.1 Creating a Table View Using Interface Builder
  35. 3.2 Creating a Table View Using Code
  36. 3.3 Assigning an Event Handler to a Table View Using
  37. Interface Builder
  38. 3.4 Assigning an Event Handler to a Table View Using Xcode
  39. 3.5 Populating a Table View with Data
  40. 3.6 Receiving and Handling Table View Events
  41. 3.7 Using Different Types of Accessories in a Table View
  42. 3.8 Creating Custom Table View Accessories
  43. 3.9 Customizing the Appearance of a Table View’s Contents
  44. 3.10 Displaying Hierarchical Data
  45. 3.11 Effectively Managing Memory with Table Views
  46. 3.12 Editing and Moving Data in a Table View
  47. 3.13 Enabling Swipe Deletion
  48. 3.14 Grouping Data
  49. 4. Core Location and Maps
  50. 4.1 Creating a Map Using Interface Builder
  51. 4.2 Creating a Map Using Code
  52. 4.3 Handling the Events of a Map
  53. 4.4 Pinpointing a Device’s Location
  54. 4.5 Displaying Built-in Pins on a Map View
  55. 4.6 Displaying Pins with Different Colors on a Map View
  56. 4.7 Creating and Displaying Custom Pins on a Map View
  57. 4.8 Retrieving Meaningful Addresses Using Spatial Coordinates
  58. 4.9 Retrieving Spatial Coordinates Using Meaningful Addresses
  59. 5. Implementing Gesture Recognizers
  60. 5.1 Detecting Swipe Gestures
  61. 5.2 Reacting to Rotation Gestures
  62. 5.3 Detecting Panning and Dragging Gestures
  63. 5.4 Detecting Long Press Gestures
  64. 5.5 Responding to Tap Gestures
  65. 5.6 Responding to Pinch Gestures
  66. 6. Networking and XML
  67. 6.1 Opening and Reading a Local XML File
  68. 6.2 Parsing an XML File into Objects
  69. 6.3 Downloading Files Synchronously
  70. 6.4 Downloading Files Asynchronously
  71. 6.5 Reading and Parsing Remote XML Files
  72. 6.6 Caching Files in Memory
  73. 6.7 Caching Files on Disk
  74. 7. Operations, Threads, and Timers
  75. 7.1 Running Tasks Synchronously
  76. 7.2 Running Tasks Asynchronously
  77. 7.3 Creating a Dependency Between Tasks
  78. 7.4 Performing a Task After a Delay
  79. 7.5 Performing Periodic Tasks
  80. 7.6 Performing Periodic Tasks Efficiently
  81. 7.7 Initializing Threads Implicitly
  82. 7.8 Exiting Threads and Timers
  83. 7.9 Avoiding Memory Leaks in Threads
  84. 8. Audio and Video
  85. 8.1 Playing Audio Files
  86. 8.2 Handling Interruptions While Playing Audio Files
  87. 8.3 Recording Audio Files
  88. 8.4 Handling Interruptions While Recording Audio Files
  89. 8.5 Playing Audio over Other Sounds That Are Playing
  90. 8.6 Playing Video Files
  91. 8.7 Capturing Thumbnails from a Video File Asynchronously
  92. 8.8 Accessing the iPod Library in Response to a User Request
  93. 9. Address Book
  94. 9.1 Accessing the Address Book
  95. 9.2 Retrieving All the People in the Address Book
  96. 9.3 Retrieving Properties of Address Book Entries
  97. 9.4 Inserting a Person Entry in the User’s Address Book
  98. 9.5 Inserting a Group Entry in the User’s Address Book
  99. 9.6 Adding Persons to Groups
  100. 9.7 Searching in the Address Book
  101. 9.8 Retrieving and Setting a Person’s Address Book Image
  102. 10. Camera and the Photo Library
  103. 10.1 Detecting and Probing the Camera
  104. 10.2 Taking Photos with the Camera
  105. 10.3 Taking Videos with the Camera
  106. 10.4 Storing Photos in the Photo Library
  107. 10.5 Storing Videos in the Photo Library
  108. 10.6 Retrieving Photos and Videos from the Photo Library
  109. 10.7 Retrieving Assets from the Assets Library
  110. 10.8 Editing Videos on an iOS Device
  111. 11. Multitasking
  112. 11.1 Detecting the Availability of Multitasking
  113. 11.2 Completing a Long-Running Task in the Background
  114. 11.3 Receiving Local Notifications in the Background
  115. 11.4 Playing Audio in the Background
  116. 11.5 Handling Location Changes in the Background
  117. 11.6 Saving and Loading the State of a Multitasking iOS Application
  118. 11.7 Handling Network Connections in the Background
  119. 11.8 Handling Notifications Delivered to a Waking Application
  120. 11.9 Handling Locale Changes in the Background
  121. 11.10 Responding to Changes in an Application’s Settings
  122. 11.11 Opting Out of Background Execution
  123. 12. Core Data
  124. 12.1 Creating a Core Data Model with Xcode
  125. 12.2 Creating and Using Core Data Model Classes
  126. 12.3 Creating and Saving Data Using Core Data
  127. 12.4 Loading Data Using Core Data
  128. 12.5 Deleting Data Using Core Data
  129. 12.6 Sorting Data Using Core Data
  130. 12.7 Boosting Data Access in Table Views
  131. 12.8 Implementing Relationships with Core Data
  132. 13. Event Kit
  133. 13.1 Retrieving the List of Calendars 502
  134. 13.2 Adding Events to Calendars 504
  135. 13.3 Accessing the Contents of Calendars
  136. 13.4 Removing Events from Calendars
  137. 13.5 Adding Recurring Events to Calendars
  138. 13.6 Retrieving the Attendees of an Event
  139. 13.7 Adding Alarms to Calendars
  140. 13.8 Handling Event Changed Notifications
  141. 13.9 Presenting Event View Controllers
  142. 13.10 Presenting Event Edit View Controllers
  143. 14. Graphics
  144. 14.1 Drawing Basic Shapes on a Graphics Context
  145. 14.2 Drawing Paths on a Graphics Context
  146. 14.3 Drawing Images on a Graphics Context
  147. 14.4 Capturing the Screen Contents into an Image
  148. 14.5 Drawing Text with Core Graphics
  149. 15. Core Motion
  150. 15.1 Detecting the Availability of an Accelerometer
  151. 15.2 Detecting the Availability of a Gyroscope
  152. 15.3 Retrieving Accelerometer Data
  153. 15.4 Detecting a Shake on an iOS Device
  154. 15.5 Retrieving Gyroscope Data
  155. Index
书名:iOS 4编程Cookbook(影印版)
国内出版社:东南大学出版社
出版时间:2011年06月
页数:617
书号:978-7-5641-2685-8
原版书书名:iOS 4 Programming Cookbook
原版书出版商:O'Reilly Media
Vandad Nahavandipoor
 
Vandad Nahavandipoor已经从事Cocoa、汇编、Delphi、.NET和Cocoa Touch软件开发很多年,对iPhone OS的开发始于SDK发布之时。从那以后,他便致力于开发基于iPhone的应用,现在也包括iPad。Vandad在开发iOS应用的过程中最有价值的资本是他在与一些向顾客提供移动应用的世界大品牌合作中积累的实际经验,如Visa和U.S.Bank。
 
 
The animal on the cover of iOS 4 Programming Cookbook is an Egyptian mongoose
(Herpestes ichneumon), also known as an ichneumon. In ancient and medieval writings,
the ichneumon is described as the enemy of the dragon, though it is more famous for
battling snakes. Historic notables such as Pliny the Elder and Leonardo da Vinci recorded
how the ichneumon would coat itself in several layers of mud, let it dry into a
form of armor, and then attack a snake, eventually going for the reptile’s throat. Later,
Rudyard Kipling’s short story Rikki-Tikki-Tavi describes the exploits of the eponymous
Indian mongoose that saves his human family from the scheming cobras in their garden.
There are more than 30 species of mongoose, and all are skilled snake-killers, due in
part to their resistance to venom. Because mongooses have chemical receptors shaped
like those of snakes, it is difficult for neurotoxins to attach and paralyze them. Their
agility, thick fur, and highly developed carnassial teeth (ideal for tearing) are also of use.
The Egyptian mongoose is the largest of all the African species, ranging from 19-23
inches long (with their black-tipped tail adding 13-21 inches more) and weighing 4-7
pounds. The animal’s fur is coarse, generally colored gray with brown flecks. Despite
its name, the Egyptian mongoose can also be found throughout most of sub-Saharan
Africa, and has even been introduced to Madagascar, Spain, Portugal, and Italy. It lives
in forest, savanna, and scrub habitats, never far from water.
The diet of the Egyptian mongoose is primarily carnivorous: it eats rodents, fish, birds,
amphibians, reptiles (including venomous snakes), and insects, though eggs and fruit
are also common. To crack eggs open, the mongoose will hold one between its legs and
throw it at a rock or other hard surface. Mongooses are very versatile in action as well
as diet; they can run backwards, roll over, swim, and stand on their hind feet.