objective c - What problems may cause setting nib file's owner to nil? -


if can load object nib file without using file's owner reason of existence of file's owner? outlet-action connections can created without use of file's owner. example can make connections directly object nib. again can't understand need file's owner. have relation mvc pattern? file's owner must of uiviewcontroller type?

during loading of nib file, cocoa generates each object serialized in nib file. then, each connection in nib file, calls setvalue:forkey: on target object create connection. connections object nil. setvalue:forkey: messages sent whatever object passed file owner.

if have no file owner, nil connections ignored. if have no nil connections, no different not having file owner. not particularly common.

all of allows instantiate multiple instances of same nib file objects, passing different file owners to loading process.


edit:

remember, nib file bunch of serialized objects. when programmatically create view controller initwithnibname:bundle:, view controller exists before nib file loaded. objects inside nib file want able refer view controller. pass view controller uinib file owner. anywhere nib file says nil, uinib replaces file owner (typically view controller).

this flexible, flexibility isn't point. there'd no way refer view controller inside nib file if didn't pass in during nib instantiation.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -