我的一个视图中有一个点击识别,点击它我应该从现有的 nib 文件中显示一个弹出视图。我添加了以下代码
FeedTabReplyView *d = [[FeedTabReplyView alloc]initWithNibName:@"FeedTabReplyView" bundle:nil];
//d.delegate = self;
//create popover and put V2 in the popover view
UIPopoverController *popoverController = [[UIPopoverController alloc] initWithContentViewController:d];
//popoverController.delegate = self; //optional
CGSize size = CGSizeMake(325, 75);
popoverController.popoverContentSize = size;
[popoverController presentPopoverFromRect:recognizer.view.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
但它会引发异常:
'NSInvalidArgumentException',原因:'-[UIPopoverController initWithContentViewController:] 未在 UIUserInterfaceIdiomPad 下运行时调用。'