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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:06:29+00:00 2026-06-17T18:06:29+00:00

I’m having a strange issue with updating the U.I. after a segue. It’s a

  • 0

I’m having a strange issue with updating the U.I. after a segue. It’s a pretty standard design: the user selects a cell in a tableview, this triggers a segue to a detail screen which reflects the values of the object–in this case, a reed–in the selected cell and allows the user to edit.

I have a picker view in the detail screen with two components, an index number and a brand.

When I click a cell, the segue goes but the U.I. does not update–the picker stays in the default state, index 0.

If I hit “cancel” to go back to the table view, then click the same cell again, the detail view WILL update properly.

If I then hit cancel and select a new cell, the detail view still reflects the last cell clicked. If I click it again, it updates properly. You get the picture: I have to click any given cell twice in order to have it update.

EDIT: I realized that I was calling the segue twice, in the storyboard and manually via code. I deleted the line of code that manually called performSegue…now the object is only being passed once, but it still does not update on the first try.

The picker is allocated (with no values) in ViewDidLoad, if that makes a difference. Then it is supposed to be updated in ViewDidAppear.

my fetchedResultsController’s cache name is initialized to “nil.” This means there is no cache, right? So that’s not the issue?

Here’s the relevant code from the table view. reedToEdit is a property on this class, which is passed to the detail controller (which has a property of the same name):

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
self.reedToEdit = [fetchedResultsController objectAtIndexPath:indexPath];

}




-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
UINavigationController *navigationController = segue.destinationViewController;
ReedDetailsViewController *controller = (ReedDetailsViewController *) [[navigationController viewControllers] objectAtIndex:0];

if ([segue.identifier isEqualToString:@"AddReed"]) {
    controller.reedToEdit = nil;
    controller.managedObjectContext = self.managedObjectContext;
    controller.delegate = self;
} else if ([segue.identifier isEqualToString:@"ShowReed"]) {
    controller.reedToEdit = self.reedToEdit;
    NSLog(@"*** prepareForSegue. reedToEdit = %@", controller.reedToEdit);
    NSLog(@"controller = %@", controller);

    controller.title = @"Edit Reed";
    controller.managedObjectContext = self.managedObjectContext;
    controller.delegate = self;
} else {
    NSLog(@"***Unrecognized segue");
    abort();
    }
}

And here’s the code from the detail controller (with the picker view).

-(void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];

    if (self.reedToEdit != nil) {
        isEditing = YES;
        [self updateInterface];
    }
}

-(void)updateInterface
{
    [picker selectRow:[self.reedToEdit.indexNumber intValue] -1
      inComponent:1
         animated:NO];

    [picker selectRow:[self rowForBrand: self.reedToEdit.brand]
      inComponent:0
         animated:NO];

}
  • 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-17T18:06:30+00:00Added an answer on June 17, 2026 at 6:06 pm

    I see several issues.

    First, the proper way to pass a parameter to your segue based in the selected index path is not setting an ivar in didSelectRowAtIndexPath: and using this ivar in prepareForSegue:. Rather, you should be using the sender object.

    UITableViewCell *cell = (UITableViewCell*) sender;
    NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
    Reed *reedToEdit = [self.fetchedResultsController objectAtIndexPath:indexPath];
    

    BTW, you can avoid the redundancy of lines like

    controller.managedObjectContext = self.managedObjectContext;
    controller.delegate = self;
    

    by putting them outside the if clause distinguishing the segues.

    Second, what is mainly a cosmetic issue is the fact that you are setting a property of the picker without animation in viewDidAppear: As a rule of thumb you should not use the animation if the control is off-screen, otherwise animation is in order. The proper place to set the value of your UI elements is in viewWillAppear: or even in viewDidLoad:, i.e. before they appear.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.