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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:10:40+00:00 2026-06-02T15:10:40+00:00

I have a button that – when pressed – loads up a table view.

  • 0

I have a button that – when pressed – loads up a table view. When the user selects a table view cell, the didSelectRowAtIndexPath will get called. At that point I want the table view to close and the view I previously had open show. I’ve got all that done. But how do I get the selected cell text to the button label of the previous view?

Currently I have a singleton data store (the data is static) with a “last selected” value that the first view controller can access. didSelectRowAtIndexPath sets that fine. But how does the previous view controller know when the table view is closed? And also, how can I keep track of which button was pressed so I know which label to change?

I have a feeling this may not even be the right way of doing this – if so, please direct me to a better way.

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

    When you return control to your previous view controller, viewWillAppear and viewDidAppear get called. You can use one of those methods to check whether “last selected” has a valid value.

    As an alternate method, you could have your didSelectRowAtIndexPath bundle up the information that the previous controller needs and post a NSNotification with that as the object (or a userinfo dictionary). That way, you could respond directly to the notification without having to determine whether there was something to do or not when the view appeared.

    Edit: Having just read your comment above about using addSubview, I’d say, forget my viewWillAppear/viewDidAppear suggestion and go with the NSNotification.

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

Sidebar

Related Questions

I have a button that shows or hides a view. When button get pressed
I have a button that, when pressed, will add a new HTML row. Within
I have a button that will create a new entry (row in a table)
I have a button that when pressed shows presents a view controller, this is
I have button that a user selects and I pop up a AlertDialog to
I have a button that when clicked will run a stored procedure on a
i have a button that runs an ajax get which takes a long time.
I have a button that will launch a process that requires UAC elevation. I
I have a button that loads more data into a datagrid when clicked. To
I have a button that will execute a stored procedure. After it's been clicked,

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.