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

  • Home
  • SEARCH
  • 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 5844115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:14:52+00:00 2026-05-22T12:14:52+00:00

In an View Controller, I have a button that creates a popOverCOntroller which contains

  • 0

In an View Controller, I have a button that creates a popOverCOntroller which contains a TableView. When the user selects something from that tableView, I want a TextField in the ViewController to populate with the text from the tableView and the popOverCOntroller to dismiss showing the ViewController.

The popOverCOntroller, ViewController,TableView code all work. I can’t figure out how to get the text back to the original ViewController.

Thanks, and I know this is abstract. Can Someone talk me through the steps I’m missing?

Eric

  • 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-05-22T12:14:53+00:00Added an answer on May 22, 2026 at 12:14 pm

    You can consider passing the reference to the text field or a mutable string via the TableViewController’s custom init method.

    If you choose to pass the text field, you can directly assign the value when the user selects a row and dismiss the popover view. If you pass a mutable string, you can set its value and later in the popover’s delegate method, set the value of the text field.

    Let me know if you need some code to go with it.

    Edit

    @interface DataViewController : UITableViewController {
        UIPopoverController *popOverController;
        UILabel             *labelToUpdate;
    }
    
    @property (nonatomic, assign) UIPopoverController *popOverController;
    @property (nonatomic, retain) UILabel *labelToUpdate;
    
    @end
    

    You will need to store a weak reference to the UIPopOverController if you need to programmatically dismiss it. labelToUpdate is the label we are going to update.

    @implementation DataViewController
    
    @synthesize popOverController;
    @synthesize labelToUpdate;
    
    - (void)dealloc
    {
        [labelToUpdate release];
        [super dealloc];
    }
    
    ....
    
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
        ...
    
        self.labelToUpdate.text = event.title;
        [self.popOverController dismissPopoverAnimated:YES];
    }
    
    @end
    

    In the UIPopOverController delegate, which would be the parent view controller, do this –

    // method trigged by button press
    - (IBAction)showChoice {
        DataViewController *viewController = [[DataViewController alloc] initWithNibName:nil bundle:nil];
    
        UIPopoverController *popOverController = [[UIPopoverController alloc] initWithContentViewController:viewController];
        popOverController.delegate = self;
    
        viewController.labelToUpdate = self.outputLabel;
        viewController.popOverController = popOverController;
    
        [popOverController presentPopoverFromRect:self.button.frame
                                           inView:self.window // Since I did this of the application delegate
                         permittedArrowDirections:UIPopoverArrowDirectionAny
                                         animated:YES];
    
    }
    
    - (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController {
        [popoverController release];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple view that creates a MPMoviePlayerViewController when the user presses a
I have a view controller that has a button that triggers a method to
I have a table view that pushes to a detail view controller. From the
I have a Table View Controller with cells. I want to update the text
I have two view controller classes in my application delegate. I can change from
I have a view controller class that has to implement several protocols. Too keep
I have a view controller that gets presented modally and changes some data that
I have a table view controller which doesn't let me manually scroll to the
I have a view with a navigation controller that I am showing modally and
This has me scratching my head. I have a view controller that implements UIPopoverControllerDelegate

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.