in theiOS development (http://www.maiziedu.com/course/ios/) , how to customize the Tabbar height of the jump hiding problem, For example, and the system comes with the tabbar height is not the same as the result of a line problem, there are push animation effect and so on some column problem not here, of course, there are many ideas, can refer to the above link himself pondering, well, the following directly on the individual think the perfect solution.
Demand1, custom tabbar, without the tabbar of the system 2, the 2nd requirement is the height of the custom Tabbar and the system is different, the system tabbar height of This is why the third requirement has multiple solutions. 3, jump hide tabbar, this demand is very simple, but in the premise of the second demand is not so easy to achieve the third requirement.
Perfect Solution (write-only key code)Custom Tabbar
Create a custom Tabbar andset frame(frame is dead, readers can change according to their own needs, The author uses a custom high of.
Ertabbar *tabbar = [[Ertabbar alloc] initWithFrame:CGRectMake(0, 0, the, -)];
set The height of the system Tabbar (other blogs or forums are resolved as well)
CGRectframe = [UIScreenmainscreen].bounds; Self. Tabbar.frame =CGRectMake(0, Cgrectgetheight(frame)-44, Cgrectgetwidth(frame), -);UIView*transitionview = [[ Self. View Subviews] Objectatindex:0];
frame.size.height = Cgrectgetheight (frame)- - ;
Transitionview.frame = frame;
Add custom tabbar to the Tabbar of the system
[Self.tabbar Addsubview:tabbar] ;
Remove the system's own Tabbarbutton in the viewwillappear method
-(void) viewwillappear: ( BOOL ) Animated
{
[Super viewwillappear:animated];
// Delete the system's own Tabbarbutton
for (UIView*tabbarbuttoninch Self. Tabbar.subviews) {
if([Tabbarbutton iskindofclass:nsclassfromstring(@ "Uitabbarbutton")]) {
[Tabbarbutton Removefromsuperview];
}
}
}
Jump Hide
- (void) Pushviewcontroller: (Uiviewcontroller*) Viewcontroller animated: (BOOL) Animated
{ if ( self . Childviewcontrollers.count) { // not the root controller
viewcontroller.hidesbottombarwhenpushed = YES ;
[super Pushviewcontroller:viewcontroller animated:animated];
}
How to troubleshoot custom Tabbar jump hiding problems in iOS