我嘗試使用彈出窗口顯示視圖。由於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中顯示相同的彈出窗口 –