ios - UIView that loaded from nib files , can i set the owner to the view it self? -
the common method init
uiview *rootview = [[[nsbundle mainbundle] loadnibnamed:@"myrootview" owner:self options:nil] objectatindex:0]
;
and in case , self refer view controller , have set owner view ,because there many outlet between .m , .xib , how situations?
you should use init method in view.m class like:
- (id)initwithnibnamed:(nsstring *)nibname{ nsarray *nibcontents = [[nsbundle mainbundle] loadnibnamed:nibname owner:nil options:nil]; self = [nibcontents lastobject]; if(self){ //do code here } return self; }
and call method viewcontroller. connect view view xib.
Comments
Post a Comment