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的引用的更多相关文章

  1. iOS: 在UIViewController 中添加Static UITableView

    如果你直接在 UIViewController 中加入一个 UITableView 并将其 Content 属性设置为 Static Cells,此时 Xcode 会报错: Static table ...

  2. iOS Container View Controller

    一.UIViewController 做iOS开发的经常会和UIViewController打交道,从类名可知UIViewController属于MVC模型中的C(Controller),说的更具体点 ...

  3. iOS 容器控制器 (Container View Controller)

    iOS 容器控制器 (Container View Controller) 一个控制器包含其他一个或多个控制器,前者为容器控制器 (Container View Controller),后者为子控制器 ...

  4. UIStoryboard类介绍(如何从Storyboard中加载View Controller)

    如何从Storyboard中加载View Controller? 1. 首先了解下UIStoryboard类: @class UIViewController; @interface UIStoryb ...

  5. iOS 自定义view里实现控制器的跳转

    1.view里实现控制器的modal 拿到主窗口的根控制器,用根控制器进行modal需要的modal的控制器 场景:点击自定义view里的按钮实现控制器的modal UIViewController ...

  6. UIViewController中各方法调用顺序及功能详解

    UIViewController中各方法调用顺序及功能详解 UIViewController中loadView, viewDidLoad, viewWillUnload, viewDidUnload, ...

  7. android中正确保存view的状态

    英文原文: http://trickyandroid.com/saving-android-view-state-correctly/ 转载此译文须注明出处. 今天我们聊一聊安卓中保存和恢复view状 ...

  8. Android自定义View研究--View中的原点坐标和XML中布局自定义View时View触摸原点问题

    这里只做个汇总~.~独一无二 文章出处:http://blog.csdn.net/djy1992/article/details/9715047 Android自定义View研究--View中的原点坐 ...

  9. 【iOS】iOS它Container View获得ViewController

    近期使用Container View来在主View Controller建立自己的子Controller,但是遇到问题.不知道怎样用代码获取Controller View附带的View Control ...

随机推荐

  1. Java强,软,弱,虚类型

    链接 http://wiseideal.iteye.com/blog/1469295

  2. html部分---样式属性;

    <!--大小--> width:宽度 height:高度 <!--背景与前景--> "background-color:#0F0; 背景颜色 background-i ...

  3. Apahce的虚拟用户认证及server-status页

    一.Apache虚拟用户认证配置 编辑配置文件加入如下内容: <Directory "/www/htdoc/fin"> Options None AllowOverri ...

  4. Java——设计模式(单例模式)

     /* * 设计模式: 对问题行之有效的解决方式,其实他是一种思想. * 1.单例设计模式. *  解决问题:  就是可以保证一个列在内存中的对象唯一性. * *如何保证对象的唯一性: *1. 不 ...

  5. python中字符串连接的三种方式

    1.字符串之间连接 'aa' 'bb' 可以中间为空格 或者什么都没有. 那么输出都是两者之间紧密相连. 2.字符串+数字 'aa' +90 这样会报错,因为不同类型不能相加, 可以用 'aa',90 ...

  6. C++ code Summary --- 2015.11.8

    C++ code summary map<int, PersonClassifier>::iterator it与 map<int, PersonClassifier> it的 ...

  7. 在windows系统上安装caffe

    下载编译 0.确认电脑上有VS2013 0.确认显卡GPU Compute Capability>=3.0 1.安装CUDA7.5 2.下载cuDNN v4,添加到CUDA7.5 3.根据htt ...

  8. 使用seajs来引入js代码

    注意的是:引入jquery的代码最好放在html文件中,本文是为了说明seajs中require如何使用的,才将jquery放入seajs中的. html中对应的代码: <script type ...

  9. QQ登入(6)腾讯微博-获取微博用户信息,发送微博

    1.1获取weibo用户信息 //先登入授权,可以参考QQ登入(1) Weibo mWeibo = new Weibo(this, mQQAuth.getQQToken()); mWeibo.getW ...

  10. Android Facebook和Twitter分享

    1. 背景 在年初的时候,公司的项目有个新的需求,在英文版的应用中加入Facebook和Twitter分享功能. 2. 完成情况 由于这个项目比较急,所以开发这个功能从预研到接入总共耗时一周.后来,在 ...