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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:34:03+00:00 2026-05-26T02:34:03+00:00

I have a UITableView consisting of three rows – each row is a data

  • 0

I have a UITableView consisting of three rows – each row is a data field in a settings screen. When the user clicks a row, I have a UIPickerView appear for them to select a value. I am using the UITableViewCellStyleValue1 – the left side is the name of the data field, and the right side (detailTextLabel) should be the value selected from the picker.

I created a targetCell ivar to hold the selected cell. In my picker, I use the below code in the didSelectRow method:

    self.targetCell.detailTextLabel.text = @"TEST";

Which works, however I have several presentational issues. The first was that the detailTextLabel text was white (although API says it should be blue??!?) I fixed this with:

    self.targetCell.detailTextLabel.textColor = [UIColor blackColor];

However, the text does not appear in the cell until I click the cell or another cell. So I tried adding a
[self.tableView reloadData];
Which does the trick of refreshing the cell and getting the label text to appear, but also removes the blue highlighting which I want to maintain.

If you could look over this code and let me know the easiest way to get the below results when selecting a value on the picker:

  • cell detailTextLabel.text immediately updates to the selected
    value in black color
  • the blue highlight on the active cell is maintained

Thanks!

- (void)pickerView:(UIPickerView *)pickerView didSelectRow: (NSInteger)row inComponent:(NSInteger)component { 
    // Handle the selection 
    self.targetCell.detailTextLabel.textColor = [UIColor blackColor];
    self.targetCell.detailTextLabel.text = @"TEST";
    [self.tableView reloadData];
} 

Edited to add final code soluton:

Thanks to chown for the answer – my final working code is:

- (void)pickerView:(UIPickerView *)pickerView didSelectRow: (NSInteger)row inComponent:(NSInteger)component { 
    // Handle the selection 
    self.targetCell.detailTextLabel.textColor = [UIColor blackColor];
    self.targetCell.detailTextLabel.text = @"TEST";
    NSIndexPath *path = [self.tableView indexPathForSelectedRow];
    [self.tableView reloadData];
    [self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:path.row inSection:0] animated:NO scrollPosition:UITableViewScrollPositionNone];
} 
  • 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-26T02:34:04+00:00Added an answer on May 26, 2026 at 2:34 am

    Try this:

    - (void)pickerView:(UIPickerView *)pickerView didSelectRow: (NSInteger)row inComponent:(NSInteger)component { 
        // Handle the selection 
        self.targetCell.detailTextLabel.textColor = [UIColor blackColor];
        self.targetCell.detailTextLabel.text = @"TEST";
        [self.tableView reloadData];
        NSIndexPath *ip = [tableView indexPathForSelectedRow];
    
        // assuming self is the tableViews delegate.  Optional
        [self tableView:tableView willSelectRowAtIndexPath:ip];
    
        [tableView selectRowAtIndexPath:ip animated:YES scrollPosition:UITableScrollPositionTop];
    
        // assuming self is the tableViews delegate.  Optional
        [self tableView:tableView didSelectRowAtIndexPath:ip];
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got an UITableView. How to simply fill it with three elements, for
I have a need to display a UITableView containing a user's account credentials. For
I have an array of objects which populate a UITableView . When a user
I have a UITableView populated with 27 rows. I am trying to change the
I have a UITableView and I want to be able to reorder the rows
I have a UITableView cell that is going to have a variable size depending
I have a UIView with a UITableView for a subview. The UIView has an
In an app I'm working on, I have a plain style UITableView that can
I have UITableView and I am trying to load it by default in edit
I have an UITableview controller without an XIB. I set the background colour of

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.