The subclass of a navigationcontroller is required first, and some basic requirements for custom Nav are set in the Init method.
1-(Instancetype) Initwithrootviewcontroller: (Uiviewcontroller *) Rootviewcontroller2 {3 if(self =[Super Initwithrootviewcontroller:rootviewcontroller]) {4 //set the background color of the navigationbar and set it yourself as needed5Self.navigationBar.barTintColor =Redbuttoncolor;6 //setting Navigationbar is transparent, opaque, causes the available interface origin to move down (0,0) to the point below the lower left corner of the navigation bar7Self.navigationBar.translucent =NO;8 //set Navigationbar is not returned by default, yes9self.interactivePopGestureRecognizer.enabled =YES;Ten //Create a color that makes it easy to set colors later OneUicolor * color =[Uicolor Whitecolor]; A //sets the background color of the navigationbar element, excluding the title -Self.navigationBar.tintColor =color; - //sets the font color for the title of the Navigationcontroller theNsdictionary * dict=[Nsdictionary dictionarywithobject:color forkey:nsforegroundcolorattributename]; -Self.navigationBar.titleTextAttributes =dict; - } - + returnSelf ; -}
Because the navigation bar is self-defined, the default side-by-side return is invalidated, and the next proxy to follow the gesture in the Viewdidload
-(void) viewdidload{ // Create weak Reference object typeof (self) weakself = Self ; if ([Self respondstoselector: @selector (Interactivepopgesturerecognizer)]) { Self.interactivepopgesturerecognizer. delegate = weakself; }}
OK, Finish.
IOS7 above to customize a Navigationcontroller and follow the system's side-slip return effect