Skip to content

Conversation

@rokoroku
Copy link

@rokoroku rokoroku commented Nov 5, 2015

It’s necessary to make the popup container view controller public when we have to know the top-most view controller.

Without this, we should check the dynamic type of class which is less reliable.

@kevin-lyn
Copy link
Owner

@rokoroku I think you could get the top-most view controller by viewController.presentingViewController if you the "viewController" is in popup. viewController.presentingViewController is referring o the "containerViewController" in this case.

@rokoroku
Copy link
Author

rokoroku commented Nov 7, 2015

Of course we can get the top view controller is "STPopupContainerViewController", but we cannot check it by using isKindOfClass method because it's not a public class.

@kevin-lyn
Copy link
Owner

@rokoroku may I know why you would use isKindOfClass for checking the top-most view controller? Is it for detecting if a view controller is presented as a popup?

@rokoroku
Copy link
Author

rokoroku commented Nov 7, 2015

I usually handle a local notification by getting my navigation controller's top view controller when application is in active state. When a popup is opened, top view controller returns the popup controller. I have to know that it is instance of popup container controller or not so that I can skip it in getting the top view controller logic. (In short, I need to know the parent view controller of the popup controller.)

@bawn
Copy link

bawn commented May 18, 2017

+1

1 similar comment
@Errortype520
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants