IOS Custom Swipe toggle Tabbaritem feel design ugly also want to do out of UI effect ...

Source: Internet
Author: User

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 ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.