viezel / NappUI

A collection of extended functionality for the UI components of Titanium SDK
Other
121 stars 34 forks source link

NavigationWindow popToRoot() #39

Closed danny005 closed 9 years ago

danny005 commented 10 years ago

navWindow.popToRoot();

This does not seem to work, could not find even the extending class for TiUIiOSNavWindowProxy?

Based on the old navGroup code, this is correct?

-(void)popToRoot:(id)args
{
    ENSURE_UI_THREAD(popToRoot,args);

    UINavigationController * controller = [self controller];
    NSUInteger controllers = [[controller viewControllers] count];

    for (UIViewController * thisVC in [[controller viewControllers] reverseObjectEnumerator])
    {
        if (![thisVC isKindOfClass:[TiViewController class]] || controllers == 1) {
            continue;
        }

        TiWindowProxy * thisProxy = (TiWindowProxy *)[(TiViewController *)thisVC proxy];
        [self closeWindow:thisProxy animated:NO];
        controllers--;
    }
}
viezel commented 10 years ago

it looks like it. You will have to test it before I can accept a pull request.

jonatansberg commented 9 years ago

Implemented in mrlundis/NappUI@031a715ec6048d500278994ed5d059edd76d77c7.

viezel commented 9 years ago

If it works, why don't you make a PR