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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:51:40+00:00 2026-05-27T04:51:40+00:00

I have a UI which contains a UITableView and a UIDatePicker. When I select

  • 0

I have a UI which contains a UITableView and a UIDatePicker. When I select a Row on my table it is highlighted, but as soon as I interact with the DatePicker (scroll to a new value) the row isn’t highlighted anymore. The value of the row is bound to that of the DatePicker. How can I permanently highlight the cell?

In the iCal-App -> Add -> Start&End I saw this behaviour.
I tried the selectRowAtIndex method in my ValueChanged-method of the picker. I thought that the highlighting is lost in this callback-method.

-(IBAction)setStartTimeMethod
{

    NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];   
    [dateFormat setDateFormat:@"EEE, dd. MMM yyyy  HH:mm"];


    if(!self.endDateRowSelected)
        self.date = [dateFormat stringFromDate:[datePicker date]];
    else
        self.endDate = [dateFormat stringFromDate:[datePicker date]];
    [dateFormat release];
//    [self.tableView1 selectRowAtIndexPath:tableView1.indexPathForSelectedRow animated:NO scrollPosition:UITableViewScrollPositionTop];
    [self.tableView1 reloadData];

}

Edit, my didSelectRowMethod

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"EEE, dd. MMM yyyy  HH:mm"];

    if(indexPath.row == 0){
        NSLog(@"Start");
        self.endDateRowSelected = NO;


        NSDate *startDate = [formatter dateFromString:self.date];
        [datePicker setDate:startDate animated:YES];

        //if(self.endDateRowSelected)
          //  [tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];

    }else if(indexPath.row == 2){
        NSLog(@"End");
        self.endDateRowSelected = YES;

        if(self.endDate){
            NSDate *endDateTime = [formatter dateFromString:self.endDate];
            [datePicker setDate:endDateTime animated:YES];
        }
    }else{
        self.endDateRowSelected = NO;
    }

    [formatter release];
//    Won't work, doesn't allow highlighting a cell.
//    [tableView deselectRowAtIndexPath:indexPath animated:NO];

}

BR,
mybecks

  • 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-27T04:51:40+00:00Added an answer on May 27, 2026 at 4:51 am

    The solution was quite easy.

    In my cellForRowAtIndexPath I must call the selectRowAtIndexPath method.

    ...
    if(indexPath.row == 0){
                    cell.description.text = [dict objectAtIndex:indexPath.row];
                    cell.dateTime.text = self.startDate;
    
                    if(!endDateRowSelected)
                        [tableView selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone]; 
                }else if(indexPath.row == 2){
                    cell.description.text = [dict objectAtIndex:indexPath.row];
                    cell.dateTime.text = self.endDate;
                    if(endDateRowSelected)
                        [tableView selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone]; 
                }
    ...
    

    The bool is set in my didSelectRowAtIndexPath, depending on clicking on Start or End.
    I still reload the table in my pickerValueChanged delegate.

    Thank you for time & help.

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

Sidebar

Related Questions

I have a table which contains my server status create table ServerStatus ( ServerId
I have a UITableView which from an external RSS feed. When you select a
I have a UITableView with 5 UITableViewCells . Each cell contains a UIButton which
I have a ViewController that contains a UITableView in which the cells are created
UITableView has custom header UIView , which contains UILabel. Since table has also section
I have a UITableView in a UINavigationController that contains a rightBarButtonItem which should hide
I have a UITableViewController which contains a UITableView. I try to control the UITableViewController's
I have a UIViewController named RootViewController which contains a UITableView and a UITabBar (2
another weird problem with the iPhone SDK here. I have a UITableView which contains
I have a view that contains a UITableView and a UILabel which works perfectly

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.