Iphone Developer
Iphone Developer

Reputation: 41

Application Platform Specification

I am designing an app for iphone & ipod the client wants the Some of the UI Specification for iphone and ipod to be different so i decided to create different XIB Files for iphone and ipod as in universal apps for iphone and ipod but the problem is that i am not able differentiate between iphone and ipod on run time is there any way to check platform on runtime so as to load different Nib Files on runtime If there is any code or tutorial please guide me to the link Thanks in advance

Upvotes: 0

Views: 103

Answers (3)

bryanmac
bryanmac

Reputation: 39296

Check the model property of UIDevice class

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIDevice_Class/Reference/UIDevice.html

However, if you switch on that string, be aware that the simulator shows up as a separate device.

This:

NSString* model = [[UIDevice currentDevice] model];
NSLog(@"model: %@", model);

Outputs:

2011-10-25 08:44:30.794 Craplet[921:b303] model: iPhone Simulator

Upvotes: 1

mafis
mafis

Reputation: 1165

[[UIDevice currentDevice] model] looks like the right source for this Information. You can check it if it contains iPod Touch or iPhone or.....

Upvotes: 1

Bastian
Bastian

Reputation: 10433

I think this was already asked several times .)

NSString *dtype = [UIDevice currentDevice].model;

if([dtype isEqualToString:@"iPhone"])
{
   // iphone 
}

Possible examples of model strings are @”iPhone” and @”iPod touch”

Upvotes: 0

Related Questions