Latest 0.2.0
Homepage https://github.com/kyleYang/KYFlipNavigationController
License MIT
Platforms ios 9.0, requires ARC
Authors

CI Status
Version
License
Platform

The KYFlipNavigationController is an custom NavigationController the use UIViewController to manager the UIViewController(include UINavigationController,UITabbarController,UIViewController) like the UINavigationController .
Many app like EasyNet News and Toutiao use TabbarController UINavigationController when push

Overview

alt tag

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Init

Set up flipNavigationController as root of a window,self.flipNavigationController will find the KYFlipNavigationController if it’s exist!


   let firstVC = FirstViewController(nibName: nil, bundle: nil);
   firstVC.title = "First"
   let firstNavi = UINavigationController(rootViewController: firstVC)

   let sencondVC = SecondViewController(nibName: nil, bundle: nil);
   sencondVC.title = "Second"

   let tabbar = RDVTabBarController()
   tabbar.viewControllers = [firstNavi,sencondVC]
   
   let flipViewController = KYFlipNavigationController(rootViewCotroller: tabbar)
   self.window = UIWindow();
   self.window?.backgroundColor = UIColor.white;
   self.window?.rootViewController = flipViewController;
   self.window?.makeKeyAndVisible()

Push or Pop

Push and pop almost like the UINavigationController . The key way is to find the flipNavigationController. It’s easy that we use a UIViewController’s extension

   //Push
   let  viewController = ThirdViewController(nibName: nil, bundle: nil)
   viewController.title = "cell_(indexPath.row)"
   // push a navigationcontroller
   let navi = UINavigationController(rootViewController: viewController)
   self.rdv_tabBarController.flipNavigationController?.pushViewController(navi, animated: true)//self is add to a tabbarcontroller

   //we also an push a UIViewController,and if self is not add to a tabbarcontroller
   self.flipNavigationController?.pushViewController(viewController, animated: true)

     //Pop
    self.flipNavigationController?.popViewController(true)
    //also we can pop to a viewcontroller or to the rootviewcontroller

The public func

   //Push
   pushViewController(_ viewController : UIViewController, animated : Bool, completed : KYFlipNavigationCompletionBlock? = nil)

   //Pop
   public func popViewController(_ animated : Bool, completed : KYFlipNavigationCompletionBlock? = nil)
   public func popToViewController(_ viewController : UIViewController, animated : Bool, completed : KYFlipNavigationCompletionBlock? = nil)
   public func popToRootViewControllerAnimated(_ animated : Bool ,completed : KYFlipNavigationCompletionBlock?)

Change the stack

You can also change the UIViewController stack when you want,so you can remove some viewcontroller or add some viewcontroller from the stack and change the pop way


    guard let viewControllers = self.flipNavigationController?.viewControllers else {
        return
    }
    var newControllers : Array<UIViewController> = []
    for viewController in viewControllers {
       if !viewController.isKindOfClass(ForthViewController.self) {
            newControllers.append(viewController)
        }
    }
    self.flipNavigationController?.viewControllers = newControllers

Requirements

Installation

KYFlipNavigationController is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "KYFlipNavigationController"

Author

kyleYang, [email protected]

If you find any porblem , please tell me

License

KYFlipNavigationController is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "KYFlipNavigationController",
    "version": "0.2.0",
    "summary": "A Custom NavigationController that use UIViewController to manager the UIViewCotroller which can use for push and pop",
    "description": "This Custome NavigationContoller can easy be used in UITabBarController and UINavigationController, You can push a UINavigationController or UITabBarController in a UINavigationController like EasyNet News app.",
    "homepage": "https://github.com/kyleYang/KYFlipNavigationController",
    "license": "MIT",
    "authors": {
        "kyleYang": "[email protected]"
    },
    "source": {
        "git": "https://github.com/kyleYang/KYFlipNavigationController.git",
        "tag": "0.2.0"
    },
    "platforms": {
        "ios": "9.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "pushed_with_swift_version": "3.1"
}

Pin It on Pinterest

Share This