63
New to Native? Getting Started with iOS Development

New to native? Getting Started With iOS Development

Embed Size (px)

Citation preview

Page 1: New to native?   Getting Started With iOS Development

New to Native?Getting Started with iOS Development

Page 2: New to native?   Getting Started With iOS Development

@ggeoffreggeoffre.com

20 years of experience in the development, marketing, sales, and leadership of computer

software

A C T S

Page 3: New to native?   Getting Started With iOS Development

Before you do anything…

Search Google for…

“Apple Mobile HIG”

Apple’s Mobile Human Interface Guidelines

developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/

Page 4: New to native?   Getting Started With iOS Development

Popover

TableView

Page 5: New to native?   Getting Started With iOS Development

Using XcodeStep One - Get a Mac, any Mac

Step Two - Get Xcode

Download the free version of Xcode from the app store

Create a free developer account and download Xcodedeveloper.apple.com

Register your company and pay for a developer account to download Xcode betas

Page 6: New to native?   Getting Started With iOS Development

Creating a new project

Page 7: New to native?   Getting Started With iOS Development

Master Detail

Page 8: New to native?   Getting Started With iOS Development

Master Detail

Page 9: New to native?   Getting Started With iOS Development

Page Based

Page 10: New to native?   Getting Started With iOS Development

Page Based

Page 11: New to native?   Getting Started With iOS Development

Tabbed

Page 12: New to native?   Getting Started With iOS Development

Tabbed

Page 13: New to native?   Getting Started With iOS Development

Toolbar - Run, Stop, Show, Hide

Navigation - Project, Symbol, Find, Issue, Test, Debug, Breakpoint, Report

Editors - Source, Interface Builder, Project

Debugger - Stack Viewer, Output Console

Inspector/Library - File, Help, Code, Object, Media

The Basics of Xcode

Page 14: New to native?   Getting Started With iOS Development

The Basics of Xcode

Page 15: New to native?   Getting Started With iOS Development

The Basics of Xcode

Page 16: New to native?   Getting Started With iOS Development

The Basics of Xcode

Page 17: New to native?   Getting Started With iOS Development

Working with the UILabel

Drag and drop the object in IB onto the view

Page 18: New to native?   Getting Started With iOS Development

Working with the UILabel

Connect the object in IB to Code

Page 19: New to native?   Getting Started With iOS Development

Working with the UIButton

Drag and drop the object in IB onto the view

Page 20: New to native?   Getting Started With iOS Development

Working with the UIButton

Connect the object in IB to Code

Page 21: New to native?   Getting Started With iOS Development

Working with the UIButton

Create an action for the object

Page 22: New to native?   Getting Started With iOS Development

Working with the UITextView

Drag and drop the object in IB onto the view

Page 23: New to native?   Getting Started With iOS Development

Working with the UITextView

Connect the object in IB to Code

Page 24: New to native?   Getting Started With iOS Development

Working with the UITextView

Add the delegate interface to the View

Page 25: New to native?   Getting Started With iOS Development

Working with the UITextView

Set the objects delegate as the view

Page 26: New to native?   Getting Started With iOS Development

Working with the UITextView

Control the keyboard

//make the keyboard display

[textField becomeFirstResponder];

//make the keyboard hide

[textField resignFirstResponder];

Page 27: New to native?   Getting Started With iOS Development

Working with the UITextView

Implement optional delegate methods

//Dismiss the keyboard when the return key is tapped- (BOOL)textFieldShouldReturn:(UITextField *)textField { if (textField == self.someTextfield) { [textField resignFirstResponder]; return NO; } return YES;}

//Only allow numeric characters- (BOOL) textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range

replacementString:(NSString *)newString{ NSCharacterSet* notNumbers = [[NSCharacterSet characterSetWithCharactersInString:@"0123456789"] invertedSet]; NSUInteger location = [newString rangeOfCharacterFromSet:notNumbers].location; return ( location == NSNotFound );}

Page 28: New to native?   Getting Started With iOS Development

Managing Editing

textFieldShouldBeginEditing:

textFieldDidBeginEditing:

textFieldShouldEndEditing:

textFieldDidEndEditing:

Editing the Text Field’s Text

textField:shouldChangeCharactersInRange:replacementString:

textFieldShouldClear:

textFieldShouldReturn:

Working with the UITextView

Page 29: New to native?   Getting Started With iOS Development

Review: Working with the…

UILabel UIButton UITextField

Page 30: New to native?   Getting Started With iOS Development

Working with the UILabel

Drag and drop the object in IB onto the view

Connect the object in IB to Code

Page 31: New to native?   Getting Started With iOS Development

Working with the UIButton

Drag and drop the object in IB onto the view

Connect the object in IB to Code

Create an action for the object

Page 32: New to native?   Getting Started With iOS Development

Working with the UITextView

Drag and drop the object in IB onto the view

Connect the object in IB to Code

Add the delegate interface to the View

Set the objects delegate as the view

Implement optional delegate methods

Page 33: New to native?   Getting Started With iOS Development

Debugging in the Simulator

Managing Devices

Page 34: New to native?   Getting Started With iOS Development

Debugging in the Simulator

Reseting the Simulator

Page 35: New to native?   Getting Started With iOS Development

Debugging in the Simulator

Toggle, Run, Step Over, Step Into, Step Out

Page 36: New to native?   Getting Started With iOS Development

float someFloat = 1.2345;int someInteger = 6;NSString *someString = @"Seven";NSLog(@"Some Float: %f Some Integer: %i Some String: %@“ , someFloat, someInteger, someString);

Technical Note TN2347

Logging console messages

Debugging in the Simulator

Page 37: New to native?   Getting Started With iOS Development

Working with Colors

Use the Color Picker

To save yourcolor choices

Page 38: New to native?   Getting Started With iOS Development

Working with Colors

Add the UIKit Frameworkto your project

Page 39: New to native?   Getting Started With iOS Development

Working with Colors#import <Foundation/Foundation.h>#import <UIKit/UIKit.h>

@interface UIColor (My)

+(UIColor *) MyOffWhiteColor;

@end

@interface UIFont (My)

+(UIFont *) MyLightFontWithFontSize:(float)fontSize;

@end#import "MyColorsAndFonts.h"

@implementation UIColor (My)

+(UIColor *) MyOffWhiteColor { return [UIColor colorWithRed: 252.0/255.0 green: 251.0/255.0 blue: 247.0/255.0 alpha: 1.0]; };

@end

@implementation UIFont (My)

+(UIFont *) MyLightFontWithFontSize:(float)fontSize { return [UIFont fontWithName:@"HelveticaNeue-Light" size:fontSize]; }

@end

Create a customColor and Font

Class

Page 40: New to native?   Getting Started With iOS Development

Working with Colors

http://www.javascripter.net/faq/hextorgb.htm

Color Sync Utility

Digital Color Meter

Hex-to-RGB Conversion

Page 41: New to native?   Getting Started With iOS Development

Transitons Animations

Disable Auto Layouton the View

Page 42: New to native?   Getting Started With iOS Development

Working with the UILabel

Connect the object in IB to Code

Page 43: New to native?   Getting Started With iOS Development

Transitons Animations[UIView animateWithDuration:3.0 animations:^{

[self.someLabel setAlpha:1.0];

}];

Write Some Code

[UIView animateWithDuration:0.5 delay:0 usingSpringWithDamping:500.0f initialSpringVelocity:0.0f options:UIViewAnimationOptionCurveLinear animations:^{ [self.someLabel setAlpha:1.0];

}completion:^{

[self doSomething];

}];

[self.view setNeedsUpdateConstraints];[UIView animateWithDuration:3.0 animations:^{

[self.someLabel setAlpha:1.0];

[self.view layoutIfNeeded];}];

Page 44: New to native?   Getting Started With iOS Development

UIAlertView and its Delegate

UIAlertView *alertView = [[UIAlertView alloc]initWithTitle: @"Some Title" message:@"Some Alert” delegate:self cancelButtonTitle:@“Cancel" otherButtonTitles:@"Ok", nil]; [alertView show];

Display an Alert

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex: (NSInteger)buttonIndex{

switch (buttonIndex) { case 0: NSLog(@"Cancel"); break; case 1: NSLog(@"OK"); break; default: break; }}

Respond to an Alert

Page 45: New to native?   Getting Started With iOS Development

Storyboards and Nibs (Xibs)

Nibs and Xibs are the same

“N” is for NeXt, “ib” is for Interface Builder

“X” is for XML, “ib” is for Interface Builder

One .xib file for one

Storyboards are like Xibs for multiple UIView Controllers

Page 46: New to native?   Getting Started With iOS Development

Creating a new Xib

Page 47: New to native?   Getting Started With iOS Development

Creating a new Storyboard

Page 48: New to native?   Getting Started With iOS Development

Binding in Interface Builder

Select the ViewController in Interface Builder

Navigate to the Identity Inspector

Set the Custom Class Name

Set the Storyboard ID

Page 49: New to native?   Getting Started With iOS Development

Storyboards and Nibs (Xibs)Creating a UIViewController from a Storyboard

Creating a UIViewController from a Nib (Xib)

SomeViewController* someViewController = [self.storyboard instantiateViewControllerWithIdentifier:@“SomeView"];

[[self navigationController] presentViewController:someViewController animated:YES completion:nil];

SomeViewController* someViewController = [[SomeViewController alloc] initWithNibName:@"SomeViewController" bundle:nil];

[[self navigationController] presentViewController:someViewController animated:YES completion:nil];

Page 50: New to native?   Getting Started With iOS Development

Multiple StoryboardsOne “Shared” Storyboard

Multiple Storyboards

SomeViewController* someViewController = [self.storyboard instantiateViewControllerWithIdentifier:@“SomeView"];

[[self navigationController] presentViewController:someViewController animated:YES completion:nil];

UIStoryboard *someStoryboard = [UIStoryboard storyboardWithName:@"SomeStoryboard" bundle:nil];

SomeViewController* someViewController = [someStoryboard instantiateViewControllerWithIdentifier:@“SomeView"];

[[self navigationController] presentViewController:someViewController animated:YES completion:nil];

Page 51: New to native?   Getting Started With iOS Development

Debugging on a deviceEnable Mac to be in “Development Mode”

Create Developer Account and Provisioning Profile

Add your device to your account (hard limit of 100 devices)

developer.apple.com

Page 52: New to native?   Getting Started With iOS Development

Provisioning Test Devices

Create a Provisioning Profile

Download and install Certificates

Build and Deploy Xcode Archives

Page 53: New to native?   Getting Started With iOS Development

Provisioning Test Devices

Tools

Xcode Organizer for iOS Devices and Profiles

ADC Development Provisioning Portal

ADC Development Provisioning Assistant

Certificates

WWDR Intermediate Certificate

Developer Certificate

Provisioning Profile Certificate

Page 54: New to native?   Getting Started With iOS Development

ADC iOS Provisioning Portal

Manually Manage Devices

Developers

Profiles

App IDs

Page 55: New to native?   Getting Started With iOS Development

Debugging on a device

Log on with your Apple ID to your Apple Developer

Account

Page 56: New to native?   Getting Started With iOS Development

Managing Devices

Debugging on a device

Attach the Device to your Mac

Page 57: New to native?   Getting Started With iOS Development

Debugging on a device

Check the Project Settings• Bundle Identifier• Team Provisioning Profile• Deployment Target

Select the Deviceand Run

Page 58: New to native?   Getting Started With iOS Development

Debugging on a device

airserver.com

airsquirrels.com

Page 59: New to native?   Getting Started With iOS Development

When Things Go Wrong...

Technical Note TN2250 - Understanding and Resolving Code Signing Issues

Page 60: New to native?   Getting Started With iOS Development

TestFlight Distribution

https://testflightapp.com/

Page 61: New to native?   Getting Started With iOS Development

TestFlight Distribution

Setup a free TestFlight account and create a team.

Invite and gather the UDIDs from the team members.

Add devices to your ADC Provisioning Profile.

Build an .ipa archive in Xcode and upload to TestFlight.

Distribute the build and manage the feedback.

Page 62: New to native?   Getting Started With iOS Development

TestFlight Distribution

Page 63: New to native?   Getting Started With iOS Development