Top Banner
Developing an Universal iOS app Or converting a existing one into universal...
12

Developing an Universal iOS app

Jun 13, 2015

Download

Technology

This presentation shows how to develop an universal iOS app or "convert" a existing one into universal. An universal app must work in iPad/iPod and iPhone.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Developing an Universal iOS app

Developing an Universal iOS appOr converting a existing one into universal...

Page 2: Developing an Universal iOS app

–Apple Developer Documentation

“A universal app is a single app that is optimized for iPhone, iPod touch, and iPad

devices.”

Page 3: Developing an Universal iOS app

Universal app setup• First you'll need to set project Devices as 'Universal'

Page 4: Developing an Universal iOS app

–Morpheus

“You take the blue pill -- the story ends, you wake up in your bed and believe whatever you want to believe. You take the red pill --

you stay in Wonderland and I show you how deep the rabbit-hole goes.”

Page 5: Developing an Universal iOS app

ViewControllers

• Consider defining separate view controller classes for iPhone and iPad devices.

• If you use a single view controller class for both platforms, your code must support both iPhone and iPad screen sizes.

Page 6: Developing an Universal iOS app

Views• Consider using separate sets of views for iPhone

and iPad devices. For custom views, this means defining different versions of your class for each device.

• If you choose to use the same custom view for both devices, make sure your drawRect: and layoutSubviews methods especially work properly on both devices.

Page 7: Developing an Universal iOS app

Using Runtime checksif (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {!

// The device is an iPad running iOS 3.2 or later.!

}!

else {!

// The device is an iPhone or iPod touch.!

}

Page 8: Developing an Universal iOS app

Drawing objects

self.wrapper.frame = CGRectMake(15, 10, self.frame.size.width - 30, 135);

Page 9: Developing an Universal iOS app

Using different .XIB for the same ViewController

Page 10: Developing an Universal iOS app

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {!

self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];!

} else {!

self.view = [[[NSBundle mainBundle] loadNibNamed:@"DDSigninFormViewController~ipad" owner:self options:nil] objectAtIndex:0];!

}

Page 11: Developing an Universal iOS app

Live demo/coding

Page 12: Developing an Universal iOS app

Thank you!

@[email protected]