Wiley.com
Print this page Share

Beginning iOS Programming: Building and Deploying iOS Applications

ISBN: 978-1-118-84147-1
336 pages
February 2014
Beginning iOS Programming: Building and Deploying iOS Applications (1118841476) cover image

Description

iOS 7 changed everything—get up to speed!

iOS 7 is a major shift in the look and feel of apps—the first major sea change since the iPhone was first introduced. For apps to blend in with the new UI, each needs a complete redesign. Beginning iOS Programming: Building and Deploying iOS Applications starts at the beginning—including an introduction to Objective C—and gives you the skills you need to get your apps up and running. Author Nick Harris has extensive experience developing for iOS and provides a solid background for teaching the building blocks of app development.

  • Learn Objective-C and how it differs from other programming languages
  • Turn your app idea into an actionable plan
  • Build each feature with the help of standalone chapters
  • Assemble your project into a real-world iOS app

Throughout the book, you'll be able to experiment with dozens of recipes from real-life scenarios, creating an app as you learn. The book's website features download sample apps to follow along with the instruction, and sample code to illustrate ideas.

See More

Table of Contents

Introduction xix

Chapter 1: Building a Real-World iOS App: Bands 1

Introducing Bands 2

Getting Started 3

Scoping the App 4

Defining the Features 5

Creating a Development Plan 6

Summary 6

Chapter 2: Introduction to Objective-C 9

Exploring the History of Objective-C 9

Explaining the Basics 10

Learning About Objects and Classes 12

Instantiating Objects 16

Managing Memory 22

Introducing Automatic Reference Counting 26

Adding Properties to a Class 27

Explaining Strings 32

Using Basic Data Structures 35

Discussing Advanced Concepts 39

Explaining the Model-View-Controller Design Pattern 39

Learning About Protocols and Delegates 41

Using Blocks 44

Handling Errors 44

Summary 47

Chapter 3: Starting a New App 51

Creating a New App in Xcode 51

Discussing Xcode Templates 54

Learning About Bundle Identifiers 54

Exploring the Xcode Project Layout 55

Discussing the UIKit Framework 56

Discussing the Main Storyboard 56

Adding a Label to a Storyboard 56

Exploring Interface Builder 57

Setting Attributes 58

Exploring the Inspectors 59

Aligning UI Objects 59

Running in the Simulator 59

Choosing a Device 60

Learning to Test on All Device Sizes 61

Learning About Auto Layout 62

Discussing Auto Layout Basics 64

Testing Rotation 64

Exploring Application Settings 66

Setting Version and Build Numbers 66

Setting Supported Rotation Orientations 67

Setting the App Icon 68

Setting Launch Images 70

Running on a Device 71

Summary 72

Chapter 4: Creating a User Input Form 75

Introducing the Band Model Object 75

Creating the Band Model Object 76

Creating Enumerations 77

Adding Properties to the Band Model Object 78

Building an Interactive User Interface 79

Learning About IBOutlet 79

Using UITextField and UITextFieldDelegate 81

Using UITextView and UITextViewDelegate 84

Using UIButton and IBAction 85

Using UIStepper 87

Using UISegmentedControl 89

Using UISwitch 90

Saving and Retrieving Data 91

Implementing the NSCoding Protocol 91

Saving Data 93

Retrieving Saved Data 95

Deleting Saved Data 97

Summary 100

Chapter 5: Using Table Views 103

Exploring Table Views 104

Learning About Tables 104

Learning About Cells 107

Implementing the Bands Data Source 110

Creating the Band Storage 110

Adding Bands 113

Displaying Bands 119

Implementing Sections and Index 121

Adding Section Headers 122

Showing the Section Index 122

Editing Table Data 123

Enabling Edit Mode 124

Deleting Cells and Data 125

Modifying Data 126

Summary 130

Chapter 6: Integrating the Camera and Photo Library in iOS Apps 133

Adding an Image View and Gesture Recognizer 134

Enabling User Interactions with a UIImageView 134

Learning About Gesture Recognizers 136

Selecting a Picture from the Photo Library 139

Learning About UIImagePickerController 140

Determining Device Capabilities 140

Allowing Picture Editing 141

Saving Band Images 143

Deleting Band Images 145

Taking a Picture with the Camera 147

Summary 150

Chapter 7: Integrating Social Media 153

Sending E-mails and Text Messages 154

Using the E-mail Composer 154

Using the Message Composer 160

Simplifying Social Network Integration 163

Introducing the Activity View Controller 164

Learning About Twitter Integration 167

Learning About Facebook Integration 168

Learning About Flickr Integration 169

Limiting Sharing Options 170

Summary 172

Chapter 8: Using Web Views 175

Learning About Web Views 175

Loading a URL 180

Loading a URL That Contains Special Characters 182

Showing User Feedback 183

Adding Navigation 186

Creating a Toolbar 186

Opening Safari 191

Summary 193

Chapter 9: Exploring Maps and Local Search 195

Learning About Map Views 196

Getting the User’s Location 198

Changing the Map Type 201

Performing a Local Search 203

Animating Annotations 209

Interacting with Annotations 211

Summary 215

Chapter 10: Getting Started with Web Services 219

Learning About Web Services 220

Exploring the iTunes Search API 220

Discussing JSON 221

Adding the Search View 223

Introducing NSURLSession 227

Creating and Scheduling a Data Task 227

Parsing JSON 231

Displaying Search Results 233

Previewing Tracks 236

Showing Tracks in iTunes 239

Summary 240

Chapter 11: Creating a Universal App 243

Transitioning to a Universal App 244

Supporting Rotation Using Auto Layout 249

Learning About Popovers 250

Presenting Action Sheets in Popovers 250

Using the UIPopoverController 252

Finishing the iPad Implementation 258

Summary 265

Chapter 12: Deploying Your iOS App 267

Deploying the App to Beta Testers 268

Registering Beta Devices 269

Generating Digital Certificates 271

Creating an App ID and Ad Hoc Provisioning Profile 274

Signing and Deploying an Ad Hoc Build 276

Submitting the App to Apple 280

Exploring iTunes Connect 280

Creating an App Store Provisioning Profile 283

Validating and Submitting an App 284

Summary 285

Appendix: Answers to Exercises 287

Index 293

See More

Author Information

Nick Harris is an Independent Software Developer at Clifton Garage Mobile LLC. He began developing for iPhone using iPhone OS 2.0 and has created and released over a half dozen apps using every version of iOS though iOS 7. Along with his accomplishments as a developer, Nick has twice been a speaker at the 360iDev Developer Conference sharing his experience developing iOS apps for both individuals and corporate enterprises.

See More

Downloads

Download TitleSizeDownload
README 824 bytes Click to Download
Full Code Download 684.65 KB Click to Download
Chapter 3 50.81 KB Click to Download
Chapter 4 56.29 KB Click to Download
Chapter 5 65.49 KB Click to Download
Chapter 6 67.92 KB Click to Download
Chapter 7 71.70 KB Click to Download
Chapter 8 80.14 KB Click to Download
Chapter 9 86.55 KB Click to Download
Chapter 10 89.92 KB Click to Download
Chapter 11 106.77 KB Click to Download
See More

Errata

Do you think you've discovered an error in this book? Please check the list of errata below to see if we've already addressed the error. If not, please submit the error via our Errata Form. We will attempt to verify your error; if you're right, we will post a correction below.

ChapterPageDetailsDatePrint Run
4 82-3 Text correction: Errors in code under "Adding a UITextField"
The sixth line of code under step 9:
self.bandObject = [[BandObject alloc] init];

should read:
self.bandObject = [[WBABand alloc] init];

The last lines of code under step 10 on page 83:
{
   self.bandObject.name = self.nameTextField.text;
   [self saveBandObject];
   [self.nameTextField resignFirstResponder];
   return YES;
}


should read:

{
   self.bandObject.name = self.nameTextField.text;
   [self.nameTextField resignFirstResponder];
   return YES;
}
4/18/14
10 97 Text correction: Error in code under "Retrieving Data from NSUserDefaults"
Step 3, first line of code at top of page:

self.bandObject = [[BandObject alloc] init];

should read:

self.bandObject = [[WBABand alloc] init];
4/18/14
9 215 Text Correction: Error in Code
At top of page, 6th line of code:
Currently reads:
WebViewController *webViewController = (WebViewController *)segue.destinationViewController;
Should read:
WBAWebViewController *webViewController = (WBAWebViewController *)segue.destinationViewController;
06/26/14
10 225 Text Correction: Error in Code
Step 17, line 4 of code.
Currently reads:
#import ?WebViewController.h?
Should read:
#import ?WBAWebViewController.h?
06/26/14
10 226 Text Correction: Error in Code
At the beginning text for step 20.
Currently reads:
"20. Modify the prepareForSegue:sender: method with the following code:
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if([segue.destinationViewController class] == [WebViewController class])
{
WebViewController *webViewController =
segue.destinationViewController;
webViewController.bandName = self.bandObject.name;
}
"
Should read(bold denotes the fixed text):
"20. Modify the prepareForSegue:sender: method with the following code:
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if([segue.destinationViewController class] == [WBAWebViewController class])
{
WBAWebViewController *webViewController =
segue.destinationViewController;
webViewController.bandName = self.bandObject.name;
}
"
06/26/14
11 261 Text Correction: Error in Code
The first line near bottom of page, under "Try It Out" Step 1:
Currently reads:
1. From the Xcode menu select File > New > File, and create a new subclass of the WBAMapViewController called WBAMapViewController_iPad
2. Select the WBAMapViewController_iPad.h file from the Project Navigator.
Should Read:
1. From the Xcode menu select File > New > File, and create a new subclass of the WBAMapSearchViewController called WBAMapSearchViewController_iPad
2. Select the WBAMapSearchViewController_iPad.h file from the Project Navigator.
06/27/14
262 Text Correction: Error in Code
Step 9
Currently Reads:
1. From the Xcode menu select File > New > File, and create a new subclass of the WBAMapViewController called WBAMapViewController_iPad
2. Select the WBAMapViewController_iPad.h file from the Project Navigator.
Should Read:
1. From the Xcode menu select File > New > File, and create a new subclass of the WBAMapSearchViewController called WBAMapSearchViewController_iPad
2. Select the WBAMapSearchViewController_iPad.h file from the Project Navigator.
11 262 Text Correction: Error in Code
Page 262, try it out, step 5
Currently Reads:
5. Select the WBAMapViewController_iPad.m file
Should Read:
5. Select the WBAMapSearchViewController_iPad.m file
08/22/14
11 262 Text Correction: Error in Code
Page 262, try it out, step 9
Currently Reads:
9. Drag a new View Controller onto the storyboard, and set its class to the WBAMapViewController_iPad class
Should Read:
9. Drag a new View Controller onto the storyboard, and set its class to the WBAMapSearchViewController_iPad class
08/22/14
11 262 Text Correction: Error in Code
Page 262, try it out, step 13
Currently Reads:
13. Connect the IBOutlets, IBActions, and delegates to the WBAMapViewController_iPad class.
Should Read:
13. Connect the IBOutlets, IBActions, and delegates to the WBAMapSearchViewController_iPad class
08/22/14
11 264 Text Correction: Error in Code
Step 12, line 3 of code.
Currently reads:
if([segue.destinationViewController class] ==
[WebViewController_iPad class])
{
WebViewController_iPad *webViewController =
segue.destinationViewController;

Should read:
if([segue.destinationViewController class] ==
[WBAWebViewController_iPad class])
{
WBAWebViewController_iPad *webViewController =
segue.destinationViewController;

06/26/14
12 Text Correction
Line 5:
CURRENTLY READS:
CardinalDirection windDirection = CardinalDirectionNorth;
SHOULD READ:
CardinalDirection windDirection = NORTH;
10/02/14
See More
Instructors Resources
Wiley Instructor Companion Site
Request a print evaluation copy
Contact us
See More
See Less
Back to Top