ios - How to hide bottom view of tabbar -
i'm using custom tabbar following code:
uiimage *selectedimage0 = [uiimage imagenamed:@"homedb.png"]; uiimage *unselectedimage0 = [uiimage imagenamed:@"homelb.png"]; uiimage *selectedimage1 = [uiimage imagenamed:@"scheduledb.png"]; uiimage *unselectedimage1 = [uiimage imagenamed:@"schedulelb.png"]; uiimage *selectedimage2 = [uiimage imagenamed:@"buildingsdb.png"]; uiimage *unselectedimage2 = [uiimage imagenamed:@"buildingslb.png"]; uiimage *selectedimage3 = [uiimage imagenamed:@"informationdb.png"]; uiimage *unselectedimage3 = [uiimage imagenamed:@"informationlb.png"]; uiimage *selectedimage4 = [uiimage imagenamed:@"moredb.png"]; uiimage *unselectedimage4 = [uiimage imagenamed:@"morelb.png"]; uitabbar *tabbar = self.tabbarcontroller.tabbar; tabbar.tintcolor = [uicolor redcolor]; uitabbaritem *item0 = [tabbar.items objectatindex:0]; uitabbaritem *item1 = [tabbar.items objectatindex:1]; uitabbaritem *item2 = [tabbar.items objectatindex:2]; uitabbaritem *item3 = [tabbar.items objectatindex:3]; uitabbaritem *item4 = [tabbar.items objectatindex:4]; [item0 setfinishedselectedimage:selectedimage0 withfinishedunselectedimage:unselectedimage0]; [item1 setfinishedselectedimage:selectedimage1 withfinishedunselectedimage:unselectedimage1]; [item2 setfinishedselectedimage:selectedimage2 withfinishedunselectedimage:unselectedimage2]; [item3 setfinishedselectedimage:selectedimage3 withfinishedunselectedimage:unselectedimage3]; [item4 setfinishedselectedimage:selectedimage4 withfinishedunselectedimage:unselectedimage4];
my problem when customize tabbar, there still have view (which set color red) @ bottom of tabbar. this:
is there anyway remove without hidding default tabbar , replace custom view? i've check in stackoverflow, in uitabbar reference still find no way.
i think want, replace custom tabbar:
- (void)oppohidetabbarviewcontroller { if (self.tabbarviewcontroller.tabbar.hidden == yes) { return; } uiview *contentview; if ( [[self.tabbarviewcontroller.view.subviews objectatindex:0] iskindofclass:[uitabbar class]] ) { contentview = [self.tabbarviewcontroller.view.subviews objectatindex:1]; } else { contentview = [self.tabbarviewcontroller.view.subviews objectatindex:0]; } contentview.frame = cgrectmake(contentview.bounds.origin.x, contentview.bounds.origin.y, contentview.bounds.size.width, contentview.bounds.size.height + self.tabbarviewcontroller.tabbar.frame.size.height); self.tabbarviewcontroller.tabbar.hidden = yes; } - (void)opposhowtabbarviewcontroller { if (self.tabbarviewcontroller.tabbar.hidden == no) { return; } uiview *contentview; if ([[self.tabbarviewcontroller.view.subviews objectatindex:0] iskindofclass:[uitabbar class]]) { contentview = [self.tabbarviewcontroller.view.subviews objectatindex:1]; } else { contentview = [self.tabbarviewcontroller.view.subviews objectatindex:0]; } contentview.frame = cgrectmake(contentview.bounds.origin.x, contentview.bounds.origin.y, contentview.bounds.size.width, contentview.bounds.size.height - self.tabbarviewcontroller.tabbar.frame.size.height); self.tabbarviewcontroller.tabbar.hidden = no; }
Comments
Post a Comment