popoverviewController crash on iPhone, works on iPad

前端 未结 2 1919
甜味超标
甜味超标 2021-01-26 22:31

a noob question here:

any ideas why this code:

UIViewController* popoverviewController = [[UIViewController alloc]init];
UIView* popoverView = [[UIView a         


        
相关标签:
2条回答
  • 2021-01-26 22:56

    You cannot use a UIPopoverController with iPhone. U will need to detect which device idiom u are using and present the appropriate viewController type at runtime.

    The project here provides some examples. The basic gist of it is the following:

     if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
         /* use iPhone related viewController via either presentModal or via UIViewController containment */
     }else{
         /* Using an iPad use a popoverController */
     }
    

    Good Luck.

    0 讨论(0)
  • 2021-01-26 23:16

    Because UIPopoverController is only available on the iPad.

    0 讨论(0)
提交回复
热议问题