futuretap / InAppSettingsKit

This iOS framework allows settings to be in-app in addition to or instead of being in the Settings app.
https://www.futuretap.com/blog/inappsettingskit-3-0
Other
3.19k stars 545 forks source link

Pop to IASKSettingsViewController after change UITabBar.viewControllers #324

Closed st400 closed 6 years ago

st400 commented 8 years ago

I add a observer for kIASKAppSettingChanged notification and would like to change the tabBar viewControllers:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(settingsChanged:) name:kIASKAppSettingChanged object:nil];
- (void) settingsChanged: (NSNotification*) notification {
    NSMutableArray *tabs = [NSMutableArray array];
    [tabs addObjectsFromArray:self.tabBarController.viewControllers];

    UIViewController *newViewController = [[UIViewController alloc] init];
    newViewController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"New tab" image:nil tag:0];
    [tabs addObject:newViewController];

    self.tabBarController.viewControllers = tabs;
}

After update the viewControllers the IASKAppSettingsViewController pop to the root SettingsViewController. Is the behavior wanted?

How can I change the tabbar viewControllers by pressing the toggle buttons without change the current view?

iask

futuretap commented 8 years ago

How should that be an issue in IASK? You're replacing all view controllers of the tab bar controller so I do expect that they are all thrown back to root.

st400 commented 8 years ago

If I execute the same method (settingsChanged:) from a button within a custom UIViewController it behaves differently - they not thrown back.

futuretap commented 8 years ago

You can provide a sample project and I'll look into it when my time permits.

futuretap commented 6 years ago

Please check if the issue persists in the latest update and create a new issue if needed.