in Education by
In my UITableView, i need to get the event of the user, so when the cell is selected(checked), i put btn_checked.png and when it's unchecked, i put the btn_unchecked.png. I guess, what i try to do should be in the didSelectRowAtIndexPath method, so this is my code: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSArray *listData =[self->tableContents objectForKey: [self->sortedKeys objectAtIndex:[indexPath section]]]; UITableViewCell* theCell = [tableView cellForRowAtIndexPath:indexPath]; UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"btn_unchecked.png"]]; theCell.accessoryView = imageView; } My snippet code doesn't work, so the btw_unchecked.png isn't placed when the row is checked, also, i need to get the event of checked/unchecked to place the right image to the right event. Thanx in advance. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
As an example, this code snippet will toggle the cell's checkmark when the cell is tapped. The pattern is to force a selective reload from the table's datasource when the delegate method is invoked. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { // Dequeue the cell... then: static NSString *CellIdentifier = @"tvcOEList"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } cell.accessoryType = (cell.accessoryType == UITableViewCellAccessoryNone) ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES]; }

Related questions

0 votes
    I've managed to read some values into a table view and display them in the Master View of a ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    I am trying to change an image depending on what option is selected in a drop down menu. I am ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 1, 2022 in Education by JackTerrance
0 votes
    name any four tools in Gimp used for changing the pixel arrangement in an image Select the correct answer from above options...
asked Dec 24, 2021 in Education by JackTerrance
0 votes
    Which of the following attribute specifies if the element must have it's spelling or grammar checked? A - item B - itemcheck C - spellcheck D - itemgroup...
asked Dec 3, 2020 in Technology by JackTerrance
0 votes
    I have a 9-cell grid containing images (using bootstrap columns). The grid works fine and is responsive ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    I've been using Git for a while now and have recently downloaded an update only to find this warning message ... share repos with? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I am new to VBA and I'm trying to create a form in Access where a text box is enabled or ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 5, 2022 in Education by JackTerrance
0 votes
    I have a,b,c in a table with check boxes I want by clicking sub button echoing value of checkboxes that are checked...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    If you see jqGrid demo : http://www.trirand.com/blog/jqgrid/jqgrid.html Section : Advanced --> ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 11, 2022 in Education by JackTerrance
0 votes
    If you see jqGrid demo : http://www.trirand.com/blog/jqgrid/jqgrid.html Section : Advanced --> ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 10, 2022 in Education by JackTerrance
0 votes
    I have a column array with the following values in my sheet: 11, 15, 5, 7, 2. I want to ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    I have a column array with the following values in my sheet: 11, 15, 5, 7, 2. I want to ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    Why a mercury cell gives a constant voltage throughout its life ? Select the correct answer from above options...
asked Jan 5, 2022 in Education by JackTerrance
0 votes
    What is not true in context of HTML tag ? O Table cell changes its width automatically based on content O We can ... table border is o Select the correct answer from above options...
asked Nov 30, 2021 in Education by JackTerrance
0 votes
    How would you identify specific points in an image based on the pixels around the point(s) that you ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
...