从nib文件,创建实例,并不是创建"一个"实例,而是方框中拖进去的各个实例,这些实例有的是UIView类型,有的是UIControl类型,有的是UIViewController类型,有的是NSObject类型。
- (nullable NSArray *)loadNibNamed:(NSString *)name
owner:(nullable id)owner
options:(nullable NSDictionary *)options;
所用这些实例,随着nib文件的解档而被唤醒赋予鲜活的生命,保存到被nib文件加载函数的数组类型的返回值中。
An array containing the top-level objects in the nib file. The array does not contain references to the File’s Owner or any proxy objects; it contains only those objects that were instantiated when the nib file was unarchived. You should retain either the returned array or the objects it contains manually to prevent the nib file objects from being released prematurely.
1、IBFilesOwner不会分配内存实例,IBFirstResponder不会分配内存实例,通过owner关联,以后的连线既是对owner的动态运行是的绑定kvc设置成员、方法(即iboutlet,ibaction)。
2、非UIView/UIControl的类型,会分配内存实例。可以通过连线,可以作为本nib文件内任何其它实例的outlet、outletcollections
注意:External object并不会分配内存实例。
3、UIView/UIControl类型,会分配内存实例。可以连线,添加其它的iboutlet,也可以做IBFilesOwner的iboutlet
可以通过连线,成员属性、成员方法
iboutlet
iboutlet collection
ibaction
上面的2,3,可以作为filesowner的outlet
上面的2可以作为filesowner的outlet,也可以作为3的customClass类的实例的outlet
上面的3的子views可以作为它的实例的outlet

网友评论