ios - Tabbar buttons order changed after go to other view -
i have 2 buttons in tabbar, programmatically added. order changed after navigating placeholder within view.
when open app:
when go movies tab:
the code:
self.searchbutton = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemsearch target:self action:@selector(togglesearchbar)]; uiimage* meetupbuttonicon = [uiimage imagenamed:@"meetup_logo_icon"]; uiimage* meetupbuttoniconhighlighted = [uiimage imagenamed:@"meetup_logo_icon_highlighted"]; cgrect frameimg = cgrectmake(0, 0, 25, 25); uibutton *meetupuibutton = [[uibutton alloc] initwithframe:frameimg]; [meetupuibutton setbackgroundimage:meetupbuttonicon forstate:uicontrolstatenormal]; [meetupuibutton setbackgroundimage:meetupbuttoniconhighlighted forstate:uicontrolstatehighlighted]; [meetupuibutton addtarget:self action:@selector(togglemeetup:) forcontrolevents:uicontroleventtouchupinside]; uibarbuttonitem *meetupicon =[[uibarbuttonitem alloc] initwithcustomview:meetupuibutton]; self.meetupbutton = meetupicon; [self.navigationitem setrightbarbuttonitems:[nsarray arraywithobjects:_meetupbutton, _searchbutton, nil]];
the strange thing need add buttons in wrong order in array: _meetupbutton, _searchbutton , looks change right order. question how force images in same order.
something maybe goes wrong. working, leftbarbuttonitems
of navigationitem
can ordered sequence of array
assign , rightbarbuttonitems
of navigationitem
can ordered inverted sequence of array
assign.
maybe can give try!
Comments
Post a Comment