在UIViewController中获得Container View里的embed viewController的引用
When you want to use a controller you use the UIStoryboard method instantiateViewControllerWithIdentifier:, using the identifier that you give to the controller in IB,but this method will create a new instance of the UIViewController.
You can also use the performSegueWithIdentifier:sender: method (which also instantiated the view controller). You should check out the "Using View Controllers in Your App" section in the Apple docs. It also makes reference to the fact that child view controllers are instantiated at the same time as the container controller.
- (void) prepareForSegue:(UIStoryboardSegue*)segue sender:(id)sender
{ // -- Master View Controller
if ([segue.identifier isEqualToString:@"embedViewController1"])
{
self.frontViewController = segue.destinationViewController;
self.frontViewController.delegate = self;
NSLog(@"front segue %d",self.frontViewController.sliderButton.tag);
// ...
}
// -- Detail View Controller
else if ([segue.identifier isEqualToString:@"embedViewController2"])
{
self.backViewController = segue.destinationViewController;
// ...
NSLog(@"back segue");
}
}
After edit: If you embed a container view in another view controller, that embedded view's controller can be referenced from the containing controller with self.childViewControllers (which will be an array, so if there is just one, you can get it with lastObject).
在UIViewController中获得Container View里的embed viewController的引用的更多相关文章
- iOS: 在UIViewController 中添加Static UITableView
如果你直接在 UIViewController 中加入一个 UITableView 并将其 Content 属性设置为 Static Cells,此时 Xcode 会报错: Static table ...
- iOS Container View Controller
一.UIViewController 做iOS开发的经常会和UIViewController打交道,从类名可知UIViewController属于MVC模型中的C(Controller),说的更具体点 ...
- iOS 容器控制器 (Container View Controller)
iOS 容器控制器 (Container View Controller) 一个控制器包含其他一个或多个控制器,前者为容器控制器 (Container View Controller),后者为子控制器 ...
- UIStoryboard类介绍(如何从Storyboard中加载View Controller)
如何从Storyboard中加载View Controller? 1. 首先了解下UIStoryboard类: @class UIViewController; @interface UIStoryb ...
- iOS 自定义view里实现控制器的跳转
1.view里实现控制器的modal 拿到主窗口的根控制器,用根控制器进行modal需要的modal的控制器 场景:点击自定义view里的按钮实现控制器的modal UIViewController ...
- UIViewController中各方法调用顺序及功能详解
UIViewController中各方法调用顺序及功能详解 UIViewController中loadView, viewDidLoad, viewWillUnload, viewDidUnload, ...
- android中正确保存view的状态
英文原文: http://trickyandroid.com/saving-android-view-state-correctly/ 转载此译文须注明出处. 今天我们聊一聊安卓中保存和恢复view状 ...
- Android自定义View研究--View中的原点坐标和XML中布局自定义View时View触摸原点问题
这里只做个汇总~.~独一无二 文章出处:http://blog.csdn.net/djy1992/article/details/9715047 Android自定义View研究--View中的原点坐 ...
- 【iOS】iOS它Container View获得ViewController
近期使用Container View来在主View Controller建立自己的子Controller,但是遇到问题.不知道怎样用代码获取Controller View附带的View Control ...
随机推荐
- 如何区分JS中的this?!
->我们一般只研究函数执行的时候里面的this->this是谁和当前的函数在哪执行和在哪定义没有半毛钱的关系 1)看函数执行的时候,函数名之前是否有".",有的话&qu ...
- leetcode 109 Convert Sorted List to Binary Search Tree ----- java
Given a singly linked list where elements are sorted in ascending order, convert it to a height bala ...
- 三级联动查询全国省市区(xml与数据库)
提供有china.xml和china.sql文件,实现全国省市区的三级联动效果 一.xml实现 import java.awt.EventQueue; import javax.swing.JFram ...
- spark-DataFrame之RDD和DataFrame之间的转换
package cn.spark.study.core.mycode_dataFrame; import java.io.Serializable;import java.util.List; imp ...
- iOS 导出 ipa 包时 三个选项的意义
OS 导出 ipa 包时 三个选项的意思 如图 在 iOS 到处 ipa包的时候 会有三个选项 Save for iOS App Store Deployment Save for Ad Hoc D ...
- eclipse关掉jsp,js的语法验证
转载:http://blog.csdn.net/testcs_dn/article/details/39058959 eclipse加速之禁用JS.jsp等文件的语法验证 去除eclipse的JS验证 ...
- 系统镜像以及微PE工具箱
微PE地址:http://www.wepe.com.cn/download.html MSDN镜像下载地址:http://msdn.itellyou.cn/ 小白也能轻松装系统(win10 64位) ...
- java performance
http://www.oracle.com/technetwork/java/performance-138178.html# http://www.oracle.com/technetwork/ja ...
- 常用邮件 smtp pop
常用的邮箱服务器(SMTP.POP3)地址.端口 sina.com: POP3服务器地址:pop3.sina.com.cn(端口:110) SMTP服务器地址:smtp.sina.com.cn(端口 ...
- python小程序:无限求和平均
编写一个程序,重复读取数据,直到用户输入‘done’.一旦输入‘done’,打印总和.个数与平均值.如果用户输入的不是数字,使用try和except捕获异常,打印错误信息,然后跳过继续执行循环. ar ...