從nib文件,創(chuàng)建實例,并不是創(chuàng)建"一個"實例,而是方框中拖進去的各個實例,這些實例有的是UIView類型,有的是UIControl類型,有的是UIViewController類型,有的是NSObject類型。
- (nullable NSArray *)loadNibNamed:(NSString *)name
owner:(nullable id)owner
options:(nullable NSDictionary *)options;
所用這些實例,隨著nib文件的解檔而被喚醒賦予鮮活的生命,保存到被nib文件加載函數(shù)的數(shù)組類型的返回值中。
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不會分配內(nèi)存實例,IBFirstResponder不會分配內(nèi)存實例,通過owner關(guān)聯(lián),以后的連線既是對owner的動態(tài)運行是的綁定kvc設(shè)置成員、方法(即iboutlet,ibaction)。
2、非UIView/UIControl的類型,會分配內(nèi)存實例。可以通過連線,可以作為本nib文件內(nèi)任何其它實例的outlet、outletcollections
注意:External object并不會分配內(nèi)存實例。
3、UIView/UIControl類型,會分配內(nèi)存實例。可以連線,添加其它的iboutlet,也可以做IBFilesOwner的iboutlet
可以通過連線,成員屬性、成員方法
iboutlet
iboutlet collection
ibaction
上面的2,3,可以作為filesowner的outlet
上面的2可以作為filesowner的outlet,也可以作為3的customClass類的實例的outlet
上面的3的子views可以作為它的實例的outlet