GithubHelp home page GithubHelp logo

Comments (2)

cs13886 avatar cs13886 commented on June 26, 2024

I write a categary for FlipBoardNavigationController .
So it has two new function

  1. -(void)popToViewController:(UIViewController*)toViewController;
    you can use this pop to any controller in FlipBoardNavigationController.viewcontrollers

2-(void)popToRootViewController;
you can easy pop to the root viewcontroller

***************FlipBoardNavigationController.h ***
// FlipBoardNavigationController+extention.h
//
// Created by CHEN on 14-3-19.
//

#import "FlipBoardNavigationController.h"

@interface FlipBoardNavigationController (extention)

-(void)popToViewController:(UIViewController*)toViewController;
-(void)popToRootViewController;

@EnD

***************FlipBoardNavigationController.h end ***

***************FlipBoardNavigationController.m ***
//
// FlipBoardNavigationController+extention.m
//
// Created by CHEN on 14-3-19.
//

#import "FlipBoardNavigationController+extention.h"
#import <FlipBoardNavigationController.h>

@implementation FlipBoardNavigationController (extention)

-(void)popToViewController:(UIViewController*)toViewController{

NSMutableArray *controllers = self.viewControllers;
NSInteger index = [controllers indexOfObject:toViewController];
UIViewController *needRemoveViewController;

for (int i = controllers.count - 2; i >index; i--) {

    needRemoveViewController = [controllers objectAtIndex:i];
    [needRemoveViewController.view setAlpha:0];

    [needRemoveViewController removeFromParentViewController];
    [controllers removeObject:needRemoveViewController];
}

[self popViewController];

}

-(void)popToRootViewController{
UIViewController *rootController = [self.viewControllers objectAtIndex:0];
[self popToViewController:rootController];
}

************_FlipBoardNavigationController.m end_

from flipboardnavigationcontroller.

leopardvipman avatar leopardvipman commented on June 26, 2024

非常感谢啊

------------------ 原始邮件 ------------------
发件人: "Jun.Chen";[email protected];
发送时间: 2014年4月2日(星期三) 上午10:21
收件人: "michaelhenry/FlipBoardNavigationController"[email protected];

主题: Re: [FlipBoardNavigationController] how could i pop to rootcontroller? (#16)

I write a categary for FlipBoardNavigationController .
So it has two new function

  1. -(void)popToViewController:(UIViewController*)toViewController;
    2-(void)popToRootViewController;

***************FlipBoardNavigationController.h ***
// FlipBoardNavigationController+extention.h
//
// Created by CHEN on 14-3-19.
//

#import "FlipBoardNavigationController.h"

@interface FlipBoardNavigationController (extention)

-(void)popToViewController:(UIViewController*)toViewController;
-(void)popToRootViewController;

@EnD

***************FlipBoardNavigationController.h end ***

***************FlipBoardNavigationController.m ***
//
// FlipBoardNavigationController+extention.m
//
// Created by CHEN on 14-3-19.
//

#import "FlipBoardNavigationController+extention.h"
#import

@implementation FlipBoardNavigationController (extention)

-(void)popToViewController:(UIViewController*)toViewController{
NSMutableArray *controllers = self.viewControllers; NSInteger index = [controllers indexOfObject:toViewController]; UIViewController *needRemoveViewController; for (int i = controllers.count - 2; i >index; i--) { needRemoveViewController = [controllers objectAtIndex:i]; [needRemoveViewController.view setAlpha:0]; [needRemoveViewController removeFromParentViewController]; [controllers removeObject:needRemoveViewController]; } [self popViewController];
}

-(void)popToRootViewController{
UIViewController *rootController = [self.viewControllers objectAtIndex:0];
[self popToViewController:rootController];
}

************_FlipBoardNavigationController.m end_


Reply to this email directly or view it on GitHub.

from flipboardnavigationcontroller.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.