报错:-[UIPopoverController initWithContentViewController:] called when not running under UIUserInterfaceIdiomPad.
知识点1:
UIPopoverController是iPad开发中的控件,iPhone开发中是不能使用的。
知识点2:
创建UIPopoverController实例化对象时必须创建出相应的ContentViewController
// 方法1
UIPopoverController *popVc = [[UIPopoverController alloc] initWithContentViewController:[[UIViewController alloc] init]];
// 方法2
UIViewController *viewController = [[UIViewController alloc] init];
UIPopoverController *popVc = [[UIPopoverController alloc] init];
popVc.contentViewController = viewController;
// 方法3
UIViewController *viewController = [[UIViewController alloc] init];
UIPopoverController *popVc = [[UIPopoverController alloc] init];
[popVc setContentViewController:viewController animated:YES];
知识点3:
-(void)presentPopoverFromBarButtonItem:(UIBarButtonItem *)item permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated;
-(void)presentPopoverFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated;