我目前有一个覆盖整个屏幕的 subview ,并带有一个 UIButton。当我按下按钮时,我会使用 [self presentModalViewController:controller animated:YES];
调出一个用于发送电子邮件的不同 View ,这会调出新 View (viewcontroller),但位于 subview 之后。如果我按下一个按钮 removeFromSuperview
并且 subview 消失了,那么电子邮件 View Controller 就可见了。
使用 presentModalViewController
时是否可以设置 Z-index 或其他东西?
我不想在 subview 向上滑动之前将其移除。我希望它在用户键入电子邮件等时一直保留在那里。所以当他完成后, subview 仍然显示。
显示 subview (打开按钮)
[self.view.superview addSubview:pinSpecsView];
点击按钮
UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:@"Share" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Email", @"Message", nil];
popupQuery.actionSheetStyle = UIActionSheetStyleDefault;
[popupQuery showInView:self.view];
[popupQuery release];
在选择“电子邮件”后显示电子邮件 Controller
MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
....
[self presentModalViewController:controller animated:YES];
最佳答案
我认为您应该将 pinSpecsView 添加到 self.view 而不是 self.view.superview。
[self.view addSubview:pinSpecsView];
要更改 subview 的 Z 顺序,请使用 sendSubviewToBack: bringSubviewToFront: 方法。
关于iphone - 如何在 subview 上方呈现 ModalViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7946231/