Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to retain TableViewCell colour while toggling controllers in iOS
    primarykey
    data
    text
    <p>I have created StoryBoard segue application containing 1st CategoryViewController and 2nd CheckListTableController. Category(buttons) wise I am opening different question list on tableview of CheckListTableController.</p> <p>I have set check and uncheck button and its respective colour in tableView cell. I have taken NSMutableArray and adding indexPath to this to set the particular colour to cell.</p> <p>When I am navigating between these controller I want my tableView cell colour should be reserve. </p> <p>Any Idea how to do this. Thanks in advance.</p> <p><strong>Edited with query 26Aug13</strong></p> <p>Now I need same functionality by using plist file or Core data. So that user can save sessions of task and access it later. Eg. in session one he did check uncheck mark for ABC building then session saved. Session two again he did check/unchk activity for different location XYZ building then saved.</p> <p>Which method would be suitable here. Plist file or Core data? Can you redirect me to specific solution. </p> <p><strong>Edit with some Code</strong></p> <pre><code>Catergory_ViewController.m - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if([segue.identifier isEqualToString:@"chkListTable"]) { NSString *bldgArrayString = [[NSString alloc] initWithFormat:@"bldg"]; checkListTableViewController *chk= segue.destinationViewController; chk.gotquestArrayString = bldgArrayString; } } checkListTableViewController.m - (void)viewDidLoad { [super viewDidLoad]; if ([gotquestArrayString isEqual:@"bldg"]) { buildingQuest = [[NSMutableArray alloc]initWithObjects:@"Motor vehicles are not parked in the space", @"Lightning protection system (Electronic)", @"Lightning protection systems available on all buildings", @"Reception facilities in order and not damaged", } } //tableView button method where indexPath added to MutableArray -(void)yesAction:(id)sender { arrayCheckUnchek = [[NSMutableArray alloc]init]; UIButton *button = (UIButton *)sender; UITableViewCell *cell = (UITableViewCell *)button.superview.superview; UITableView *curTableView = (UITableView *)cell.superview; NSIndexPath *indexPath = [curTableView indexPathForCell:cell]; cell.backgroundColor = [UIColor greenColor]; [arrayCheckUnchek addObject:indexPath]; } - (void)tableView: (UITableView*)tableView willDisplayCell: (UITableViewCell*)cell forRowAtIndexPath: (NSIndexPath*)indexPath { // UITableViewCell *Cell = [myChklist cellForRowAtIndexPath:indexPath]; if ([arrayCheckUnchek containsObject:indexPath]) { cell.backgroundColor = [UIColor greenColor]; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload