The UI ugly but to continue to do the speech:
When the UI is not satisfied, it will feel ugly explosion, long time, but ugly habits.
On the previous tabbar many ugly, ugly finally don't tabbar ... But the process of customizing Tabbar and solving problems can be documented
Target effect:
and has the switch effect, but did not say clearly, the specific switching effect, such as sticky, elasticity?
So I made a flexible one.
See the implementation effect
I. Principle:
(1) Normal toggle selection effect, directly affixed to the Tabbar, Tabbar and then customize the processing layer
(2) The triggering event is on the Tabbar, there is no picture. This process is trickery, reducing the overall customization difficulty
Two. Problems encountered
-(void) Tabbarcontroller: (Uitabbarcontroller *) Tabbarcontroller Didselectviewcontroller: (Uinavigationcontroller *) Viewcontroller
Proxy method, how to distinguish between the selected view controller?
-(void) Tabbarcontroller: (Uitabbarcontroller *) Tabbarcontroller Didselectviewcontroller: ( Uinavigationcontroller *) viewcontroller{ *VC = viewController.viewControllers.firstObject; = Vc.tabBarItem.tag; NSLog (@ "Clicked the first%ld tab" , tag); //tag from the assignment of the view initialization }
-(Uiviewcontroller *) minevc{ if (! _MINEVC) { = [[Uiviewcontroller alloc]init]; *title = nil; = [[Uitabbaritem alloc] Initwithtitle:title image:nil selectedimage:nil]; = 2; // this is where the root controller of the different views is marked to differentiate _minevc.view.backgroundcolor = [Uicolor redcolor]; } return _MINEVC;}
In the application of continuous interaction, tabbar of the reasonable display and hidden?
The display is displayed on the main interface of the view controller Tabbar other cases are hidden, the processing scheme:
In the view Controller base class Hfbaseviewcontroller, the Tabbar is shown hidden logic judgments, and the interactive process naturally shows hidden non-abrupt processing
#Import<UIKit/UIKit.h>@InterfaceHfbaseviewcontroller:uiviewcontroller@end//////////@InterfaceHfbaseviewcontroller () @end @implementation Hfbaseviewcontroller- (void) Viewdidload {[SuperViewdidload]; Self.view.backgroundColor= [Uicolor colorwithconfigkey:@ "Bg_white"]; if(!Self.fd_prefersnavigationbarhidden) {[Self setdefaultbackbuttonitem]; } if(@available (IOS 11.0, *) {[Uiscrollview appearance].contentinsetadjustmentbehavior=Uiscrollviewcontentinsetadjustmentnever; } Else{self.automaticallyadjustsscrollviewinsets=NO; } self.edgesforextendedlayout = Uirectedgenone; //prevent Tabbar occlusion View}
#pragma mark-show Tabbar animations- (void) Viewwillappear: (BOOL) animated{[Superviewwillappear:animated];if([FIRWALLETHOMEVC istypelegal:self]||[FIRMARKETVC istypelegal:self]||[FIRMINEVC istypelegal:self]) {Self.tabBarController.tabBar.alpha= 1.0; Self.tabBarController.tabBar.hidden=NO; return ; } [UIView animatewithduration:0.5 animations:^{Self.tabBarController.tabBar.alpha= 0.0; Self.tabBarController.tabBar.hidden=YES; } Completion:^(BOOL finished) { //none }];}
Above.
The source is on GitHub: Clone will run immediately after the pod update
Address: Hfcustomtabbardemo
IOS Custom Swipe toggle Tabbaritem feel design ugly also want to do out of UI effect ...