- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一些 View Controller ,当我点击某个按钮时,我制作了 modalView(用 UINavigationController 包装)并呈现它。
DscViewController *enterDescription = [[[DscViewController alloc] init] autorelease];
UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:enterDescription];
[self presentModalViewController:navController animated:YES];
[navController release];
问题是,如何使我的(父) View Controller 成为委托(delegate),以及当我单击 modalViewController 上的某个按钮(例如完成)以调用我的父 viewController 中的某些方法以关闭模态并从中节省一些费用模态输入?
最佳答案
我认为让一个 Controller 责怪其父 Controller 去做它应该处理的工作并不是一个好习惯。您始终可以使用 self.parentViewController
关闭当前所在的模式。
如果出于某种原因你只处理 parentViewController 中的存储,那么你可以将你的 done
按钮操作指向你当前 viewController 中的一个方法,然后使用 self.parentViewController
来触发存储的父方法。
或者直接将按钮委托(delegate)给 self.parentViewController
[button addTarget:self.parentViewController action:@selector(someMethodInParentViewController) forControlEvents:UIControlEventTouchUpInside];
关于iphone - modalViewController 委托(delegate)回调 - 如何?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6726755/
我正在展示另一个模态视图 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方法,这样就不会出现任何延迟? 最好的问候塞巴斯蒂安·森德加德 最佳答案 不
我是一名优秀的程序员,十分优秀!