How can i load the different xibs for single class depends on current device in iOS?

后端 未结 3 432
情歌与酒
情歌与酒 2021-01-23 05:50

I have the complete code in view controller. So, i need to display the same output in iPad,iPhone and iPod. So, am using single view controller for processing data.For this pur

3条回答
  •  一整个雨季
    2021-01-23 06:28

    [UIDevice currentDevice] will give you the details about the current device. use this in a if loop and select the xib for iphone or i pad.

        if([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) 
    {
     load 1 xib 
    } 
    else 
    { 
    load another 
    }
    

提交回复
热议问题