2011-10-07 82 views
0

我是新来的客观C. 我想调用一个按钮点击弹出视图。错误:异常'NSInvalidArgumentException'Pad。'

: 当我如果(self.SharePopoverView ==无) {

self.SharePopoverView = [[shareView alloc] autorelease ]; 
    *****************this line code creating some problem********* 
    self.SharepopOverController = [[[UIPopoverController alloc] initWithContentViewController:SharePopoverView] autorelease]; 

} 


[SharepopOverController presentPopoverFromBarButtonItem:self permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES]; 

我正在错误使用下面的代码

运行我的申请,我得到这个错误

由于未捕获异常'NSInvalidArgumentException'而终止应用程序,原因:' - [UIPopoverController initWithContentViewController:]未运行时调用在UIUserInterfaceIdiomPad下。“

回答

3

如果你在iPhone上运行它,它不会工作,因为UIPopoverController只为iPad设计。但是您可以参考this question以在iPhone上使用它。