'NSInvalidArgumentException', reason: '-[UIPopoverController initWithContentViewController:] called when not running under UIUserInterfaceIdiomPad.'

♀尐吖头ヾ 提交于 2019-12-08 04:05:11

问题


It is my first app that I am trying to build in Iphone and I have some problems. Although I have read similar threads here I was not able to find the answer.I want to show popoverview controller on my button click.but unable to do. i am getting exception mention in question title above below are my files .h file

@property (nonatomic,strong) UIPopoverController *popOver;
@property (nonatomic,strong) SecondViewController *popOverView;

.m file

- (IBAction)Getcompany:(id)sender {
    SecondViewController *popoverview=[self.storyboard instantiateViewControllerWithIdentifier:@"popover"];
    self.popOver =[[UIPopoverController alloc] initWithContentViewController:popoverview];// getting exception in this line
    popOver.delegate=self;
    [popOver presentPopoverFromRect:[sender frame] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];





}

thanx in advance


回答1:


It is not available on an iPhone. From the documentation: "Popover controllers are for use exclusively on iPad devices. Attempting to create one on other devices results in an exception."



来源:https://stackoverflow.com/questions/26865306/nsinvalidargumentexception-reason-uipopovercontroller-initwithcontentview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!