在 iPad 视图中,我添加了容器视图,添加 Xcode 后自动创建新视图并使用嵌入 segue 连接到我的主视图。现在在代码中我尝试以编程方式调用这个新视图并且不能这样做,我需要用弹出框显示这个表单。
我尝试:
PaymentCashController *newPopup = [self.storyboard instantiateViewControllerWithIdentifier:@"PaymentCash"];
[self presentViewController:newPopup animated:YES completion:nil];
这项工作,但全屏显示新视图,但我需要显示弹出窗口。我尝试了很多东西,但都不起作用(。
我试试这个:
[self performSegueWithIdentifier:@"PaymentCash" sender:nil];
但收到异常 SIGABRT
我试试这个:
PaymentCashController *newPopup = [self.storyboard instantiateViewControllerWithIdentifier:@"PaymentCash"];
UIPopoverController *popoverController = [[UIPopoverController alloc] initWithContentViewController:newPopup];
popoverController.popoverContentSize = CGSizeMake(500, 400);
CGRect popoverStartFrame = {50, 500, 100, 100};//Set the frame that you would like your popover to present from.
[popoverController presentPopoverFromRect: popoverStartFrame inView:self.view permittedArrowDirections: UIPopoverArrowDirectionLeft | UIPopoverArrowDirectionUp animated:YES];
接收异常 SIGABRT
尝试这个:
PaymentCashController *newPopup = [PaymentCashController new];
UIPopoverController *popoverController = [[UIPopoverController alloc] initWithContentViewController:newPopup];
popoverController = [[UIPopoverController alloc] initWithContentViewController:newPopup];
[popoverController presentPopoverFromRect:CGRectMake(44, 6, 111, 111) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
相同的 SIGABRT