开发者

different status bar style for iphone/ipad in universal app

开发者 https://www.devze.com 2023-03-19 00:18 出处:网络
I recently updated my iPhone only app to an universal app and successfully submitted the update to the appstore.

I recently updated my iPhone only app to an universal app and successfully submitted the update to the appstore. however, the UI-Designers behind 开发者_JAVA技巧the project would like to have individual status bar styles for each app. So the iPhone UI should have a solid black status bar where the iPad implementation should have it semi-transparent.

is there a way to tweak key/value-pairs in the info.plis file to achieve something like this?

thanks a lot for your ideas, sam


if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
     // The device is an iPad running iOS 3.2 or later.
}

is recommended way of testing the device is iPad for iOS SDK >= 3.2


Use UIDevice class to get device model type in your application

NSString* deviceType= [[UIDevice currentDevice] model];
NSString* iPad = [NSString stringWithString:@"iPad"];

Now set the style of your status bar as per the model.

if([iPad compare:[deviceType substringWithRange:NSMakeRange(0,[iPad length])]] == NSOrderedSame )
{
   //This is iPad
}
else
{
   //This is iPhone/iPod
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号