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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:58:57+00:00 2026-06-03T09:58:57+00:00

I sending a String from a UIButton to my next UITtableviewcontroller, the string is

  • 0

I sending a String from a UIButton to my next UITtableviewcontroller, the string is the UIButton Title (Monday … Sunday) the string is used by the NSPredicate to filter my table information by day.

@property (nonatomic, weak) NSString *dayOTW;

- (IBAction)selectDay:(UIButton *)sender {
UIButton *dayW = sender;
dayOTW = dayW.titleLabel.text;
NSLog(@"button press = %@", dayOTW);
}

2012-05-01 06:23:21.731 passingdata[99957:fb03] button press = Monday

And segue to my next screen

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
// Make sure your segue name in storyboard is the same as this line
if ([[segue identifier] isEqualToString:@"SendWeekDay"])
{
    // Get reference to the destination view controller
    ViewController *vc = [segue destinationViewController];

    // Pass any objects to the view controller here, like...
    vc.dayOTW = dayOTW;
   }
}

the first time I select the button no information is show in my table , if I go back and select the button again my table show with the correct information for that day .

what i am doing wrong ?

one more question related to the above .
I have 7 UIButtons one for each day on the week, how can segue from all the UIButtons with one segue ?

Thanks

  • 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-03T09:58:58+00:00Added an answer on June 3, 2026 at 9:58 am

    The segue is being called before your IBAction method, so the variable is not set the first time you click it.

    If the segue is connected to your button, then it will be the sender in prepareForSegue, so you don’t really need the action method. Just get the title in prepareForSegue:

    UIButton *dayButton = (UIButton*)sender
    vc.dayOTW = sender.titleLabel.text;
    

    To connect the same segue to all buttons, you have to ctrl-drag from each button, but give all segues the same identifier. This looks messy on the storyboard, so an alternative is to create a single segue directly from the source view controller, and in the action method (which you would need in this case, and would be connected to all of your buttons) call performSegueWithIdentifier:sender::

    -(IBAction)dayButtonPressed:(UIButton*)sender
    {
        [self performSegueWithIdentifier:@"SendWeekDay" sender:sender];    
    }
    

    This would then pass the button to the performSegue method as the sender, so you can use the code outlined above.

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

Sidebar

Related Questions

I'm sending a very large string from one application to another on localhost using
I am sending a string down from a websockets server to my client that
I am preparing and sending a JSON string from my PHP file to my
I'm sending a javascript function a string from behind code in .net. The problem
I'm sending a string of data via CURL using data from post, and receiving
I am sending a json string from my iphone application to server using ASIFormDataRequest.
From the client I am sending a string to the server what he should
I am coding a PHP rest Service. I am sending xml string from client
I am sending mail from my Java app to Gmail Account. I had used
I am sending an escaped string from JavaScript to c# controller and now I

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.