Search code examples
iosobjective-cipaduipopovercontroller

How to navigate from Pop over to some other view controller


I have a iPad view controller where there is a Settings Button. On Clicking the the Settings a Small pop over displays that pop over has a Sign Out Button. on clicking the Sign out in pop over i want the to navigate the content view to Root view controller. I Tried using Protocol and even used normal navigation it didn't help me. I am new to iPad development. How can i get this thing done.I just need basics steps for navigation from popover controller to other view controller. I know this is not a proper way of asking question i am not asking any code in return just need how this can be done i mean the methodology


Solution

  • Just to be clear, you want the following?

    1. User presses a button in someView
    2. You display a UIPopoverController with popoverContentView
    3. User presses sign out button in popoverContentView
    4. UIPopoverController disappears
    5. someView dismisses or presents a new view

    Is that accurate? If so, you can do something like this:

    1. Create a property in someView for UIPopoverController
    2. Do the same for popoverContentView's view controller
    3. Create a protocol in popoverContentView's view controller called userPressedSignOut or something
    4. In someView set content view controller's delegate to self wherever you init it
    5. When delegate method userPressedSignOut gets called dismiss UIPopoverController
    6. At the same time dismiss someView, or present a new view controller, whatever you're doing

    You definitely need to keep properties for the popover and its content view or this won't work.