简体   繁体   中英

InAppSettingsKit Inside Container - Navigation Issues

I have implemented InAppSettingsKit without issue as a modal controller. All is well there. Then I wanted to get fancy!

I added a Container to one of my custom view controllers and made the embedded segue controller target a TableViewController, everything displays just fine. Even child panes show without issue. But then my issue starts, when I go to a child pane I cannot get back. That is to say that there is no navigation controls!!

没有导航

I've read all of the other posts where most people have issues showing child panes, this isn't an issue for me, I just can't get back from them as there are no navigation controls.

I'm not sure if it's important but my custom view controller with the Container is part of a tab view controller. Perhaps this is why there is no navigation controls? Anyone else experiencing this or have a quick fix? Seems like I'm missing something simple, a setting someplace.

I'll keep working on this and update if I figure something out!

UPDATE

Our application hides the navigation bar right off the bat. I found that by unhiding this I'm able to now navigate, which makes sense. It would appear that the only way around this would be to override viewWillAppear/viewDidDisappear in the child panes to enable/disable the navigation panes...which is now looking like a real pain (no pun intended) because I'll have to create custom subviews. Trying to figure out if there is a class I can extend from InAppSettingsKit to just add these overrides.

You can find out what I had to do here: https://github.com/futuretap/InAppSettingsKit/issues/277

Also, please note that my use case was to have InAppSettingKit work in a container inside of an existing view controller and I wanted it to have a navigation bar that was previously hidden.

If this is your use case, read on...

I really didn't want to have to reinvent the wheel, so I created a subclass of the already existing IASKAppSettingsViewController class and then added in the appropriate appear/disappear functionality.

I guess this might be the way to extend the base class anywhere you want, you just need the basics set up and then have at it!

Hope this helps someone else!!

class CustomSubviewController: IASKAppSettingsViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }

    override init() {
        super.init()
    }

    required init(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }

    override init(style: UITableViewStyle) {
        super.init(style: style)
    }

    override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
    }

    func myinit (file: NSString, specifier: IASKSpecifier) -> CustomSubviewController {
        var vc = CustomSubviewController()

        vc.showDoneButton = false;
        vc.showCreditsFooter = false; // Does not reload the tableview (but next setters do it)
        vc.delegate = self.delegate;
        vc.settingsStore = self.settingsStore;
        vc.file = specifier.file();
        vc.hiddenKeys = self.hiddenKeys;
        vc.title = specifier.title();

        return vc
    }

    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)
        self.navigationController?.setNavigationBarHidden(false, animated: animated)

    }

    override func viewWillDisappear(animated: Bool) {
        super.viewWillDisappear(animated)
        self.navigationController?.setNavigationBarHidden(true, animated: animated)
    }

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM