zoukankan      html  css  js  c++  java
  • iOS @protocol UIContentContainer <NSObject>

    @protocol UIContentContainer <NSObject>

    @property (nonatomic, readonly) CGSize preferredContentSize ;//iOS8之后,加入了新的一组协议,UIViewController对这组协议提供了默认的实现,我们自定义ViewConttroller的时候可以重写这些方法来调整视图布局。

    - (void)preferredContentSizeDidChangeForChildContentContainer:(id <UIContentContainer>)container ;//我们可以使用preferredContentSize来设置我们期望的childViewController的界面的大小

    - (void)systemLayoutFittingSizeDidChangeForChildContentContainer:(id <UIContentContainer>)container;//我们可以使用preferredContentSize来设置我们期望的childViewController的界面的大小

    - (CGSize)sizeForChildContentContainer:(id <UIContentContainer>)container withParentContainerSize:(CGSize)parentSize);//.同上,依旧因为iOS8上size class概念的提出,UIViewConteroller支持了UIConntentContainer这样一组新的协议,重写这些方法可以调整视图布局,一个容器viewController可以使用这个方法设置childViewController的size,当容器viewControllerViewWillTransitionTosize:withTransitionCoordinator:被调用时(我们重写这个方法时要调用super),sizeForChildContentContainer方法将被调用。然后我们可以把需要设置desire发送给childViewController。当我们设置的这个size和当前childViewController的size一样,那么childViewController的viewWillTransitionToSize方法将不会被调用。sizeForChildContentContainer默认的实现是返回parentSize

    /* 

     This method is called when the view controller's view's size is changed by its parent (i.e. for the root view controller when its window rotates or is resized). 

     If you override this method, you should either call super to propagate the change to children or manually forward the change to children.

     */

    - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id <UIViewControllerTransitionCoordinator>)coordinator NS_AVAILABLE_IOS(8_0);

    /* 

     This method is called when the view controller's trait collection is changed by its parent.

     If you override this method, you should either call super to propagate the change to children or manually forward the change to children.

     */

    - (void)willTransitionToTraitCollection:(UITraitCollection *)newCollection withTransitionCoordinator:(id <UIViewControllerTransitionCoordinator>)coordinator NS_AVAILABLE_IOS(8_0);

    @end

  • 相关阅读:
    linux中bin和sbin目录的主要区别
    C# 值类型 引用类型 作为参数传递区别
    绿色免安装电视直播软件viviplayer
    [转]中科大校长建议停止以行政主导的高校评估
    MDS 7.0 使用中的问题 2(数据交换中图元的丢失)
    怪异的慢递公司一统快递
    [转]全国最好的医院列表
    多普达D600 问题集锦
    推荐PDG阅读器UnicornViewer
    [转]《乒乓世界》封面故事:中国男乒直板三人行
  • 原文地址:https://www.cnblogs.com/lsh1234/p/6553447.html
Copyright © 2011-2022 走看看