我尝试使用弹出窗口显示视图。由于UIPopoverController不能在IPhone上使用,我使用WEPopoverController。WEPopoverController显示视图,第二次关闭后
我的代码:
UIViewController *controller = [[UIStoryboard storyboardWithName:@"Main" bundle:nil]instantiateViewControllerWithIdentifier:@"GetDateController"];
controller.modalPresentationStyle = UIModalPresentationPopover;
WEPopoverController *pop = [[WEPopoverController alloc] initWithContentViewController:controller];
pop.delegate = self;
CGRect screen = [[UIScreen mainScreen]bounds];
CGRect r = CGRectMake(8, 8, screen.size.width-8, 57);
pop.popoverContentSize = r.size;
[pop presentPopoverFromRect:CGRectMake(200, 100, 0, 0) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
当我启动该程序,我看到过的窗口弹出,并立即消失。 当我在iPhone上使用UIPopoverController程序崩溃时,在iPad上一切正常。
我需要用WEPopoverController使它工作吗?
Alexander。
现在popover可以在iPhone启动iOS8的iPhone中使用。您可以使用 - (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller返回UIModalPresentationNone; }在iPhone中显示相同的弹出窗口 –