Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7990395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:59:42+00:00 2026-06-04T12:59:42+00:00

I have a button that when pressed shows presents a view controller, this is

  • 0

I have a button that when pressed shows presents a view controller, this is in an Universal app.

On iPhone the view controller is pushed onto the navigation stack. On iPad it is shown in a popover. The new view controller has a delegate which is the view controller responsible for the button, when the user has selected an item the new view controller sends a message to the delegate passing it what the user picked.

I know that whatever presents the popover should be responsible for dismissing it so I keep a reference to the UIPopover, so that I can dismiss it from the view controller responsible for the button (from the same view controller the popover is created).

But I’m unsure who should be responsible for popping the new view controller off the navigation stack, should it be the view controller that allows the user to pick the items, or view controller that has the button?

Should I do:

//Picker view controller
//....
[self.delegate finishedPickingItem:item];
//...

//The first view controller (the self.delegate in the above line):
-(void)finishedPickingItem:(NSString *)item {
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        [self.profilePopover dismissPopoverAnimated:YES];
    } else {
        [self.navigationController popToViewController:self animated:YES]; //Or should this be just popViewController:?
    }
    // do something with item...
}

Or:

//Picker view controller
//...
[self.delegate finishedPickingItem:item];
[self.navigationController popViewControllerAnimated:YES];
//...

//The first view controller (the self.delegate in the above line):
-(void)finishedPickingItem:(NSString *)item {
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        [self.profilePopover dismissPopoverAnimated:YES];
    }
    // do something with item...
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T12:59:44+00:00Added an answer on June 4, 2026 at 12:59 pm

    The responsible one is always the one that pushed the view controller on the navigation stack, so your first option.
    The reason for this is, that you never know how you are displaying your picker view controller, this time you push it on the stack, the next time you present it modal and in that case popping it in the picker won’t work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a button in my app that when pressed goes to a view
I have a button that shows or hides a view. When button get pressed
In my app I have a requirement that if the Home button is pressed
I have a button that when pressed, a tableview section will be added and
I have a button that, when pressed, will add a new HTML row. Within
I have a button inside of a stackpanel that has to be pressed twice
I have a UIWebView that is supposed to open when the button is pressed,
I have a UITableView that is initially offscreen and when a button is pressed,
I have an app with a quickaction shown once a button is pressed. The
I have this application that shows an item in the system's status bar, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.