ios - Make a UIVIew which appears on all .NIb files in xcode project -
i have uiview want make appear on controller have 5 controllers, 1 , 2 ,3 ,4 , 5
i have uiview on controller1 @ bottom contains 5 buttons want view appear on controllers, have searched didn't found reasonable solution, here please me out.i don't want make navigationbar because cannot add custom buttons on navigationbar.
or there technique can make custom navigationbar? appear @ bottom, have uinavigationbar @ top
you can put uiview 5 buttons in separate nib (im calling bottomnavigation in example) , add each controllers view this:
uiview* containerview = [uiview alloc] initwithframe:cgmakerect(0, 440, 320, 40)]; //adjust rect needs [[nsbundle mainbundle] loadnibnamed:@"bottomnavigation" owner:containerview options:nil]; [self.view addsubview:containerview];
and if want set target-action buttons in containerview iterate through them (before add them subview self.view):
for (uiview *view in containerview.subviews) { if ([view ismemberofclass:[uibutton class]]) { //here should check tag or equivalent make sure setting target-action right uibutton [view addtarget:target action:@selector(mymethod) forcontrolevents:uicontroleventtouchupinside]; } }
Comments
Post a Comment