從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