objective c - iPhone, how I hide a tab bar button? -
how hide individual tab bar button ?
i've searched , not found anything, full bar.
i've made progress still having problems, code in app delegate outlet tab bar, i'm calling within viewdidload
of first view shown in tab bar.
-(void)hidetabbutton { nsmutablearray *aitems = [[roottabbar items] mutablecopy]; (uitabbaritem *tabbutton in aitems) { if ([tabbutton.title isequaltostring:@"first"]) { [aitems removeobject:tabbutton]; break; } } [roottabbar setitems:aitems animated:yes]; [aitems release]; }
but gives me error, seem possible otherwise why have setitems
.
terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'directly modifying tab bar managed tab bar controller not allowed.' call stack @ first throw:
heres full code, think i'm close. my sample project
you need use setitems:animated:
this. create array of buttons want keep on uitabbar , pass instance method:
[mytabbar setitems:itemstokeep animated:true];
Comments
Post a Comment