美文网首页
stroyboard原理

stroyboard原理

作者: 王轩008_46301 | 来源:发表于2018-07-19 11:18 被阅读12次

    1.如何创建对象

    在storyboard用source code 的方式打开后,可以到xml格式的代码。xml标签中有<objects>,里面包含了要创建的对象。通过id找到相应的控制器,转换成代码(runtime -> NSSelectorFromString等),然后创建对象并显示。

    2.如何通信

    <connections>
    <action selector="dd:" destination="BYZ-38-t0r" eventType="touchUpInside" id="ImY-7o-ash"/>
    </connections>
    

    如果是个点击事件,里面可以看到IBAction对应的xml的描述,可以转换为@selector(dd:)的oc代码

    <connections>
    <outlet property="bb" destination="W5g-mt-8Sl" id="ZBN-Wk-DWe"/>
    </connections>
    

    如果是属性,可以看到outlet对应的xml的描述,转化为property修饰的对象

    相关文章

      网友评论

          本文标题:stroyboard原理

          本文链接:https://www.haomeiwen.com/subject/vxgzpftx.html