iOS show more views from xib inside view -
i working on ios app need showing more custom views xib files inside 1 view.
what need this:
you can see 1 root view, labels , 3 custom subviews. each subview has own xid file don't know how show them 1 next each other.
i put there 3 views in interface builder , thought create 3 uiview outlets , initialize them loadnibname method doesn't work. here code controller:
@interface viewcontroller_ipad () { __strong iboutlet uiview *view1; __strong iboutlet uiview *view2; __strong iboutlet uiview *view3; } @end - (void)viewdidload { [super viewdidload]; nsarray *nibcontents = [[nsbundle mainbundle] loadnibnamed:@"myview" owner:self options:nil]; view1 = [nibcontents objectatindex:0]; nibcontents = [[nsbundle mainbundle] loadnibnamed:@"myview2" owner:self options:nil]; view2 = [nibcontents objectatindex:0]; nibcontents = [[nsbundle mainbundle] loadnibnamed:@"myview3" owner:self options:nil]; view3 = [nibcontents objectatindex:0]; }
with code subviews empty , contain xib files doesn't show.
can tell me doing wrong? or if way how that? should use container instead subviews?
use
nsarray *nibcontents = [[nsbundle mainbundle] loadnibnamed:@"myview" owner:self options:nil]; [view1 addsubview:[nibcontents objectatindex:0]];
in place of
view1 = [nibcontents objectatindex:0];
Comments
Post a Comment