Home > Store

Core iOS Developer's Cookbook, The, 5th Edition

Register your product to gain access to bonus material or receive a coupon.

Core iOS Developer's Cookbook, The, 5th Edition

eBook (Watermarked)

  • Your Price: $28.79
  • List Price: $35.99
  • Includes EPUB, MOBI, and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    MOBI MOBI The eBook format compatible with the Amazon Kindle and Amazon Kindle applications.

    Adobe Reader PDF The popular standard, used most often with the free Adobe® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.


  • Copyright 2014
  • Dimensions: 7" x 9"
  • Edition: 5th
  • eBook (Watermarked)
  • ISBN-10: 0-13-351013-1
  • ISBN-13: 978-0-13-351013-3

The best place to start iOS application development

The Core iOS Developer’s Cookbook provides ready-to-use code solutions for common iOS challenges, providing recipes that help you master the core technology at the heart of iOS. Renowned iOS programming expert Erica Sadun and top iOS developer Rich Wardwell cover the topics you need to create successful mobile applications that take full advantage of iOS graphics, touches, and views.

As in all of Sadun’s iOS bestsellers, The Core iOS Developer’s Cookbook translates modern best practices into working code, distilling key concepts into concise recipes you can easily understand and apply to your own projects. This isn’t just cut-and-paste; using examples, Sadun and Wardwell fully explain both the “how” and “why” that underscore effective and successful iOS development.

Coverage includes

  • Creating direct touch-based interfaces with multi-touch, gestures, and custom gesture recognizers
  • Building and customizing controls in powerful ways
  • Adding novel motion effects
  • Alerting users via pop-ups, progress bars, local notifications, popovers, audio cues, and more
  • Using Xcode modules to easily integrate system frameworks and headers
  • Assembling views and animation, organizing view hierarchies, and understanding how views work together
  • Supporting multiple screen geometries with the breakthrough Auto Layout constraints system
  • Controlling keyboards, making onscreen elements “text aware,” and efficiently scanning and formatting text
  • Organizing user workspaces with view controllers
  • Managing photos, videos, email, and text messages
  • Leveraging enhanced iOS support for social media activities, including Flickr and Vimeo
  • Implementing VoiceOver accessibility, including text-to-speech
  • Getting started with Core Data-managed data stores
  • Leveraging powerful networking and web services support
  • Using APIs to enhance the user experience

Sample Content

Table of Contents

Preface xiii
Chapter 1: Gestures and Touches     1

Touches     1
Recipe: Adding a Simple Direct Manipulation Interface     5
Recipe: Adding Pan Gesture Recognizers     7
Recipe: Using Multiple Gesture Recognizers Simultaneously     9
Recipe: Constraining Movement     14
Recipe: Testing Touches     15
Recipe: Testing Against a Bitmap     17
Recipe: Drawing Touches Onscreen     20
Recipe: Smoothing Drawings     22
Recipe: Using Multi-Touch Interaction     26
Recipe: Detecting Circles     29
Recipe: Creating a Custom Gesture Recognizer     34
Recipe: Dragging from a Scroll View     37
Recipe: Live Touch Feedback     40
Recipe: Adding Menus to Views     45
Summary     47
Chapter 2: Building and Using Controls     49
The UIControl Class     49
Buttons     53
Buttons in Interface Builder     55
Recipe: Building Buttons     56
Recipe: Animating Button Responses     60
Recipe: Adding a Slider with a Custom Thumb     62
Recipe: Creating a Twice-Tappable Segmented Control     67
Working with Switches and Steppers     70
Recipe: Subclassing UIControl     72
Recipe: Building a Star Slider     76
Recipe: Building a Touch Wheel     79
Recipe: Creating a Pull Control     83
Recipe: Building a Custom Lock Control     88
Recipe: Image Gallery Viewer     93
Building Toolbars     96
Summary     98
Chapter 3: Alerting the User     101
Talking Directly to Your User through Alerts     101
Recipe: Using Blocks with Alerts     105
Recipe: Using Variadic Arguments with Alert Views     110
Presenting Lists of Options     112
“Please Wait”: Showing Progress to Your User     115
Recipe: Modal Progress Overlays     117
Recipe: Custom Modal Alert View     119
Recipe: Basic Popovers     124
Recipe: Local Notifications     126
Alert Indicators     128
Recipe: Simple Audio Alerts     129
Summary     133
Chapter 4: Assembling Views and Animations     135
View Hierarchies     135
Recipe: Recovering a View Hierarchy Tree     137
Recipe: Querying Subviews     139
Managing Subviews     141
Tagging and Retrieving Views     142
Recipe: Naming Views by Object Association     143
View Geometry     146
Recipe: Working with View Frames     150
Recipe: Retrieving Transform Information     158
Display and Interaction Traits     164
UIView Animations     165
Recipe: Fading a View In and Out     167
Recipe: Swapping Views     168
Recipe: Flipping Views     169
Recipe: Using Core Animation Transitions     170
Recipe: Bouncing Views as They Appear     172
Recipe: Key Frame Animations     174
Recipe: Image View Animations     176
Summary     177
Chapter 5: View Constraints     179
What Are Constraints?     179
Constraint Attributes     180
The Laws of Constraints     182
Constraints and Frames     184
Creating Constraints     186
Format Strings     189
Predicates     194
Format String Summary     196
Aligning Views and Flexible Sizing     198
Constraint Processing     198
Managing Constraints     199
Recipe: Comparing Constraints     201
Recipe: Creating Fixed-Size Constrained Views     204
Recipe: Centering Views     209
Recipe: Setting Aspect Ratio     210
Recipe: Responding to Orientation Changes     212
Debugging Your Constraints     214
Recipe: Describing Constraints     215
Constraint Macros     218
Summary     221
Chapter 6: Text Entry     223
Recipe: Dismissing a UITextField Keyboard     224
Recipe: Dismissing Text Views with Custom Accessory Views     228
Recipe: Adjusting Views Around Keyboards     230
Recipe: Creating a Custom Input View     235
Recipe: Making Text-Input-Aware Views     240
Recipe: Adding Custom Input Views to Nontext Views     243
Recipe: Building a Better Text Editor (Part I)     246
Recipe: Building a Better Text Editor (Part II)     248
Recipe: Text-Entry Filtering     252
Recipe: Detecting Text Patterns     255
Recipe: Detecting Misspelling in a UITextView     260
Searching for Text Strings     262
Summary     262
Chapter 7: Working with View Controllers     263
View Controllers     263
Developing with Navigation Controllers and Split Views     266
Recipe: The Navigation Item Class     271
Recipe: Modal Presentation     273
Recipe: Building Split View Controllers     278
Recipe: Creating Universal Split View/Navigation Apps     283
Recipe: Tab Bars     286
Remembering Tab State     290
Recipe: Page View Controllers     293
Recipe: Custom Containers     303
Recipe: Segues     309
Summary     315
Chapter 8: Common Controllers     317
Image Picker Controller     317
Recipe: Selecting Images     319
Recipe: Snapping Photos     326
Recipe: Recording Video     331
Recipe: Playing Video with Media Player     333
Recipe: Editing Video     336
Recipe: Picking and Editing Video     339
Recipe: E-mailing Pictures     341
Recipe: Sending a Text Message     344
Recipe: Posting Social Updates     347
Summary     349
Chapter 9: Creating and Managing Table Views     351
iOS Tables     351
Delegation     352
Creating Tables     353
Recipe: Implementing a Basic Table     356
Table View Cells     360
Recipe: Creating Checked Table Cells     362
Working with Disclosure Accessories     364
Recipe: Table Edits     366
Recipe: Working with Sections     374
Recipe: Searching Through a Table     381
Recipe: Adding Pull-to-Refresh to Your Table     387
Recipe: Adding Action Rows     390
Coding a Custom Group Table     395
Recipe: Building a Multiwheel Table     396
Using UIDatePicker     400
Summary     401
Chapter 10: Collection Views     403
Collection Views Versus Tables     403
Establishing Collection Views     405
Flow Layouts     407
Recipe: Basic Collection View Flows     412
Recipe: Custom Cells     416
Recipe: Scrolling Horizontal Lists     418
Recipe: Introducing Interactive Layout Effects     422
Recipe: Scroll Snapping     424
Recipe: Creating a Circle Layout     425
Recipe: Adding Gestures to Layout     431
Recipe: Creating a True Grid Layout     433
Recipe: Custom Item Menus     440
Summary     442
Chapter 11: Documents and Data Sharing     445
Recipe: Working with Uniform Type Identifiers     445
Recipe: Accessing the System Pasteboard     451
Recipe: Monitoring the Documents Folder     454
Recipe: Activity View Controller     460
Recipe: The Quick Look Preview Controller     470
Recipe: Using the Document Interaction Controller     473
Recipe: Declaring Document Support     480
Recipe: Creating URL-Based Services     486
Summary     489
Chapter 12: A Taste of Core Data     491
Introducing Core Data     491
Entities and Models     492
Creating Contexts     494
Adding Data     495
Querying the Database     498
Removing Objects     500
Recipe: Using Core Data for a Table Data Source     501
Recipe: Search Tables and Core Data     505
Recipe: Adding Edits to Core Data Table Views     508
Recipe: A Core Data-Powered Collection View     514
Summary     519
Chapter 13: Networking Basics     521
Recipe: Checking Your Network Status     521
Scanning for Connectivity Changes     524
The URL Loading System     526
Recipe: Simple Downloads     528
Recipe: Downloads with Feedback     533
Recipe: Background Transfers     543
Recipe: Using JSON Serialization     546
Recipe: Converting XML into Trees     549
Summary     554
Chapter 14: Device-Specific Development     555
Accessing Basic Device Information     555
Adding Device Capability Restrictions     556
Recipe: Checking Device Proximity and Battery States     559
Recipe: Recovering Additional Device Information     563
Core Motion Basics     565
Recipe: Using Acceleration to Locate “Up”     566
Working with Basic Orientation     568
Recipe: Using Acceleration to Move Onscreen Objects     571
Recipe: Accelerometer-Based Scroll View     575
Recipe: Retrieving and Using Device Attitude     578
Detecting Shakes Using Motion Events     579
Recipe: Using External Screens     581
Tracking Users     587
One More Thing: Checking for Available Disk Space     588
Summary     589
Chapter 15: Accessibility     591
Accessibility 101     591
Enabling Accessibility     593
Traits     594
Labels     595
Hints     596
Testing with the Simulator     597
Broadcasting Updates     599
Testing Accessibility on iOS     599
Speech Synthesis     601
Dynamic Type     602
Summary     604
Appendix A: Objective-C Literals     605
Numbers     605
Boxing     606
Container Literals     607
Subscripting     608
Feature Tests     609
Index     611


Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020