- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我有一个 navigationController,我从那里启动 ModalViewController。在这个 ModalViewController 中,我将显示 MailComposer,它本身是另一个 ModalViewController。
现在,如果用户点击发送按钮,MailComposerView 和其他 ModalViewController 应该被关闭。为此,我在 mailComposerController 中调用了一个委托(delegate)方法。
现在只有 MailComposerView 会被关闭,而不会关闭其他 ModalViewController,我会收到以下错误消息
attempt to dismiss modal view controller whose view does not currently appear. self = <UINavigationController: 0x724d500> modalViewController = <UINavigationController: 0x72701f0>
你有什么想法我会做错吗?
第一个模态视图
- (void)addList {
NSLog(@"addList");
//AddListViewController *addListViewController = [[AddListViewController alloc] init];
AddListViewController *addListViewController = [[AddListViewController alloc] initWithStyle:UITableViewStyleGrouped];
addListViewController.delegate = self;
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:addListViewController];
navigationController.navigationBar.barStyle = UIBarStyleBlack;
navigationController.navigationBar.translucent = YES;
[self presentModalViewController:navigationController animated:YES];
[navigationController release];
[addListViewController release]; }
在调用 MailView 的 AddListViewController 中
MFMailComposeViewController *mailComposer = [[MFMailComposeViewController alloc] init];
mailComposer.mailComposeDelegate = self;
NSString *subject = [NSString stringWithFormat:@"Group invite for groupname: %@", @"mhm"];
[mailComposer setSubject:subject];
// Fill out the email body text
NSString *emailBody = @"This is an group invite bla bla";
[mailComposer setMessageBody:emailBody isHTML:NO];
[self presentModalViewController:mailComposer animated:YES];
[mailComposer release];
在 mailComposerController 方法中
[self.navigationController dismissModalViewControllerAnimated:YES];
[self.delegate finishAddList:checkmark andListName:listName.text];
在 finsihAddList 委托(delegate)中
[self dismissModalViewControllerAnimated:YES];
最佳答案
我遇到了类似的问题。我有一堆模态呈现的 View Controller 。当我试图从可见的开始消除它们并向下移动堆栈时,我会因同样的错误而失败。解决方案是关闭堆栈底部的 View Controller 。它会忽略它上面的所有内容。
在您的情况下,我的解决方案相当于更改 mailComposerController 方法,使其仅包含一行(不关闭最顶层的模态 vie Controller )。
[self.delegate finishAddList:checkmark andListName:listName.text];
我知道您已经解决了您的问题,但认为这可能对其他人有帮助。
关于iphone - 两个 ModalViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3988432/
我正在展示另一个模态视图 Controller 的模态视图 Controller 。当我关闭第二个模态视图 Controller 时,第一个和第二个模态视图 Controller 都应该被关闭。我尝试
我有一个当用户单击按钮(UIModalPresentationFormSheet)时呈现的 View 。该 View 上有 4 个文本字段,单击一个按钮会在顶部弹出另一个 (UIModalPresen
当应用程序进入后台时,我需要自动关闭我的uiimagepicker模态视图 Controller 。我尝试将代码放在viewdiddissappear方法中的dismissmodalviewcontr
当设备处于横向模式时,我在主 ViewController 中重写 -orientationChanged 以推送 ModalViewController A。当放回纵向模式时,ModalViewCo
我试图通过卷页来关闭模态视图 Controller 。 curl 工作正常,但我似乎无法显示模态视图 Controller 下的表格 View 。 modalviewcontroller 的图像仍然位
经过长时间的尝试和搜索 Internet 和 StackOverflow,我找不到我需要的答案。 我的问题是一个警告: Warning: Attempt to present on whose v
如果存在某些条件,我想在启动时首先呈现一个模态视图 Controller 。我正在使用以下代码: [self presentModalViewController:vc animated:NO]; 此
我一直在研究这个,似乎唯一的方法是使用 UIActionSheet,问题是我的 UIActionSheet 只覆盖了一半的屏幕,我的代码是: MyViewController *myVC = [[my
我尝试在已加载的 View 上呈现模态视图 Controller 。 代码如下: if (!self.loginNavViewController_){ AHLoginViewCon
你好, 我有一个用户登录的应用程序,当登录详细信息正确时,modalviewcontroller 被关闭。关闭 View Controller 后,将调用另一个 View Controller 。这一
我使用那段代码将 UIViewController 显示为具有半透明背景的模态(在 IOS7 及更低版本上工作)。 MyViewController *myViewController = [[MyV
我有一个 navigationController,我从那里启动 ModalViewController。在这个 ModalViewController 中,我将显示 MailComposer,它本身
我注意到,如果我在 Controller “A”的某个元素上启动 UIView 动画并呈现带有过渡的 Controller B,则之前提交的动画不会启动。 例如: //apply a UIView a
我在 supportedInterfaceOrientations 方法中设置了 UIInterfaceOrientationMaskAll。当我呈现 UIModalViewController 时,
iOS7 和 xCode5。 我用 XIB 创建了一个 UIViewController, 1,我没有勾选“使用自动布局”选项;2、尺寸改为“任意”;3、状态栏改为“无”。 然后我在 xib 中调整了
我已经为此奋斗了几个小时。我到处搜索,似乎找不到解决我的问题的方法。我很确定我只是缺少一些关键概念。 我的 AppDelegate (didFinishLaunching) 基本上设置了我的窗口并调用
我有一个 NavigationController,它呈现一个带有按钮的 View (ShoppingController),我将其称为 ModalViewController : AddPr
我启动了一个模态视图 Controller ,在它的 init 中我有以下代码: window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScr
我曾尝试在通过模态视图 Controller 呈现的 View 上的viewWillAppear上呈现UIPopoverController。然而,当这样做时,UIPopoverController
我遇到了在 modalViewController 显示后调用 drawRect 方法的情况。是否可以先调用drawRect方法,这样就不会出现任何延迟? 最好的问候塞巴斯蒂安·森德加德 最佳答案 不
我是一名优秀的程序员,十分优秀!