I am not sure how to set different scroller size dimensions for a universal app.
I have the code below so far in the implementation file for iPhone dimensions, but not sure how to code for iPad scroller dimensions as well.
- (void)viewDidLoad {
[self.navigationController setNavigationBarHidden:NO animated:NO];
[super viewDidLoad];
[ScrollerInstructions setScrollEnabled:YES];
[ScrollerInstructions setContentSize:CGSizeMake(300, 2000)];
}
Thank you!
use this, so you can set the contenSize in dependency of the device:
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
// iPad contentSize
[ScrollerInstructions setContentSize:CGSizeMake(600, 3000)];
} else if ([[UIScreen mainScreen] bounds].size.height >= 568) {
// iPhone 5/5s contenSize
[ScrollerInstructions setContentSize:CGSizeMake(300, 2500)];
} else {
// old iPhone contenSize
[ScrollerInstructions setContentSize:CGSizeMake(300, 2000)];
}
a good way to use is, to set this as define in your .pch file like this:
#define IS_IPAD ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
#define IS_IPHONE5 (!IS_IPAD && ([[UIScreen mainScreen] bounds].size.height >= 568))
this way you can use in your source simply:
if (IS_PAD) {
} else if (IS_IPHONE5) {
}