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 8375415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:10:18+00:00 2026-06-09T15:10:18+00:00

In my iOS app i have one view controller that handles my main view.

  • 0

In my iOS app i have one view controller that handles my main view. If i have a button on that view can i have it open up a modal table view so the user can select a row from the table and then a label on the main view is equal to the selected row text?

  • 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-09T15:10:20+00:00Added an answer on June 9, 2026 at 3:10 pm

    Sure, it’s possible. You could use the method, presentViewController:animated:completion:, to present a modal table view controller. The main view controller has a property, presentedViewController which gives you access to that controller (the one you’re presenting) so you can get the value of one of its properties (which would be set to the text of the selected row).

    After Edit:

    You can do it this way. In the presenting view controller have this:

    In the init method (or viewDidLoad) register to receive a notification with this line:

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dismissAndUpdate:) name:@"ItemSelectedNotification" object:nil];
    

    Then these 2 methods:

     -(IBAction)buttonClick:(id)sender {
        RDTableViewController *tvc = [[RDTableViewController alloc] initWithStyle:UITableViewStylePlain];
        [self presentViewController:tvc animated:YES completion:nil];
    }
    
    
    -(void)dismissAndUpdate:(NSNotification *) aNotification {
        self.label.text = [aNotification.userInfo valueForKey:@"selectedText"];
        [self dismissModalViewControllerAnimated:YES];
    
    }
    

    And here is an example of what can be done in the table view controller subclass:

    @implementation RDTableViewController
    
    - (id)initWithStyle:(UITableViewStyle)style {
        if (self = [super initWithStyle:style]) {
            self.theData = @[@"one",@"two",@"three",@"foour",@"five",@"six"];
        }
        return self;
    }
    
    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
        return 1;
    }
    
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
        return self.theData.count;
    }
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
        static NSString *cellIdentifier = @"NewCell";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
        if (cell == nil) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"NewCell"];
        }
        cell.textLabel.text = [self.theData objectAtIndex:indexPath.row] ;
        return cell;
    }
    
        - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
        NSDictionary *dict = [NSDictionary dictionaryWithObject:[self.theData objectAtIndex:indexPath.row] forKey:@"selectedText"];
        [[NSNotificationCenter defaultCenter] postNotificationName:@"ItemSelectedNotification" object:self userInfo:dict];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my iOS app I have several UIElement s that can process user input:
I have an IOS App that can open a specific type of documents. My
So I have two TableView in one view of an iOS app. I have
I have a universal iOS app with a custom view that has three buttons,
I have an iOS app that uses a number of enums for valid values,
I have an iOS app with a UITableView that has flexible width, which allow
I have an old iOS app that I never distributed and am now trying
i have a simple sencha touch app in mvc style with one view in
I am writing an iOS app for a client, the main view is a
I have a test app for iOS that is built without any nib/xib files.

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.