- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *identifier = #"LeftTable";
// LabDetailsVO* objLabDetailsVO=(LabDetailsVO* )dictData;
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
}
NSArray *arrCurrentDataSource = [arrDataSource objectAtIndex:tableView.tag];
cell.textLabel.text = [arrCurrentDataSource objectAtIndex:indexPath.row];
cell.textLabel.font = FONT_ORDERS_LEFT_CELL;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
/**********************************************************************/
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell;
int lastSelectedIndexPath = [[arrSelectedIndexPaths objectAtIndex:tableView.tag] intValue];
if (lastSelectedIndexPath != -1) {
cell = [tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:lastSelectedIndexPath inSection:0]];
cell.accessoryType = UITableViewCellAccessoryNone;
}
[arrSelectedIndexPaths replaceObjectAtIndex:tableView.tag withObject:[NSString stringWithFormat:#"%d", indexPath.row]];
cell = [tableView cellForRowAtIndexPath:indexPath];
cell.accessoryType = UITableViewCellAccessoryCheckmark;
//Notify the parent controller about the new value selected by the user.
if ([idParentDelegate respondsToSelector:#selector(popOverSelectionNotifier: value: )]) {
[idParentDelegate popOverSelectionNotifier:tableView.tag value:[NSString stringWithFormat:#"%d", indexPath.row]];
}
else {
NSLog(#"Error : %# - Does not protocol(OrdersDetailPopViewControllerSelectionDelegate) method (popOverSelectionNotifier: value:)", NSStringFromClass([idParentDelegate class]));
}
}
Table view reuse the cell when it scroll,you reset design and values in cellForRowAtIndexPath
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
........
if (cell == nil)
{
..........
..........
}
if(lastSelectedIndexPath != -1)
{
cell.accessoryType = UITableViewCellAccessoryNone;
}
else
{
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
return cell;
}
Related
When i scroll Table, checkmark is hide. I know because of Reusing Cell, but I dont know how to fix. Pls help me. Here is my code:
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *identifier = #"Cell";
StudentTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier forIndexPath:indexPath];
if (cell == nil) {
cell = [[StudentTableViewCell alloc] init];
}
if (_btnCancel.hidden == NO) {
cell.accessoryType = UITableViewCellAccessoryNone;
} else {
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
return cell;
}
I change check and uncheck in didSelectRowAtIndexPath:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell* cellCheck = [tableView cellForRowAtIndexPath:indexPath];
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
if (_btnCancel.hidden == NO) {
if (cellCheck.accessoryType == UITableViewCellAccessoryNone) {
cellCheck.accessoryType = UITableViewCellAccessoryCheckmark;
TeacherInfo *courseStudent = studentQuitArray[indexPath.row];
[dict setObject:courseStudent.id_user forKey:#"student_id"];
[studentDetail addObject:dict];
} else {
cellCheck.accessoryType = UITableViewCellAccessoryNone;
[studentDetail removeObject: studentQuitArray[indexPath.row]];
}
}
}
When you scroll table view, cellForRowAtIndexPath for particular cell will be called in which your are setting the accessoryType as None. Instead try like below.
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *identifier = #"Cell";
StudentTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier forIndexPath:indexPath];
if (cell == nil) {
cell = [[StudentTableViewCell alloc] init];
}
if (_btnCancel.hidden == NO) {
TeacherInfo *courseStudent = studentQuitArray[indexPath.row];
if ([studentDetail containsObject:courseStudent]) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
else {
cell.accessoryType = UITableViewCellAccessoryNone;
}
} else {
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
return cell;
}
didSelectRowAtIndexPath:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell* cellCheck = [tableView cellForRowAtIndexPath:indexPath];
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
if (_btnCancel.hidden == NO) {
if (cellCheck.accessoryType == UITableViewCellAccessoryNone) {
cellCheck.accessoryType = UITableViewCellAccessoryCheckmark;
TeacherInfo *courseStudent = studentQuitArray[indexPath.row];
[dict setObject:courseStudent.id_user forKey:#"student_id"];
[studentDetail addObject:dict];
} else {
cellCheck.accessoryType = UITableViewCellAccessoryNone;
[studentDetail removeObject: studentQuitArray[indexPath.row]];
}
}
}
Hope this will help.
If you are reusing cells then you need to save the state of each cell .Because every time you scroll up and down, TableView will bring back the previous cell that outside of the screen.
You can save selectable state in an array and read its index in cellForRowAtIndexpath to get the current state of the cell.
You can also do this by adding one boolean property like is-selected in your "TeacherInfo" NSObject class,and set true false based on table-row selection.
Try this :
You need to add instance object of TeacherInfo instead of student id because your containedObject of array gives wrong result .
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *identifier = #"Cell";
StudentTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier forIndexPath:indexPath];
if (cell == nil) {
cell = [[StudentTableViewCell alloc] init];
}
if (_btnCancel.hidden == NO) {
TeacherInfo *courseStudent = studentQuitArray[indexPath.row];
if ([studentDetail containsObject:courseStudent]) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
else {
cell.accessoryType = UITableViewCellAccessoryNone;
}
} else {
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
return cell;
}
didSelectRowAtIndexPath:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell* cellCheck = [tableView cellForRowAtIndexPath:indexPath];
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
if (_btnCancel.hidden == NO) {
if (cellCheck.accessoryType == UITableViewCellAccessoryNone) {
cellCheck.accessoryType = UITableViewCellAccessoryCheckmark;
TeacherInfo *courseStudent = studentQuitArray[indexPath.row];
[studentDetail addObject:courseStudent];
} else {
cellCheck.accessoryType = UITableViewCellAccessoryNone;
[studentDetail removeObject: studentQuitArray[indexPath.row]];
}
}
}
I am storing at most only 3 items that are allowed to be checked at anytime.
I store the selected rows in an NSMutabeDictionary called selectedRowDictionary in didSelectRowAtIndexPath
Then in my cellForRowAtIndexPath
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:#"identifer" forIndexPath:indexPath];
if (_selectedRowDictionary && [_selectedRowDictionary count]) {
for (NSString *rowSelected in _selectedRowDictionary) {
BOOL isRowSelected = [[_selectedRowDictionary valueForKey:rowSelected] integerValue];
if (isRowSelected){
NSLog(#"rowSelected: %#", rowSelected);
} else {
NSLog(#"rowNotSelected: %#", rowSelected);
}
int rowIndexSelected = [[rowSelected substringFromIndex:[rowSelected length] - 1 ] integerValue];
if (isRowSelected && rowIndexSelected == indexPath.row) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
} else {
cell.accessoryType = UITableViewCellAccessoryNone;
}
}
}
return cell;
}
-
- didSelectRowAtIndexPath:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
if (cell.accessoryType == UITableViewCellAccessoryCheckmark) {
cell.accessoryType = UITableViewCellAccessoryNone;
if (_selectedRowDictionary) {
[_selectedRowDictionary removeObjectForKey:[NSString stringWithFormat:#"row%d", indexPath.row]];
NSLog(#"row %d removed from array", indexPath.row);
}
} else {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
[_selectedRowDictionary setValue:[NSNumber numberWithBool:YES] forKey:[NSString stringWithFormat:#"row%d", indexPath.row]];
}
if ([_selectedRowDictionary count] > 3) {
UITableViewCell *lastSelectedCell = [tableView cellForRowAtIndexPath:indexPath];
lastSelectedCell.accessoryType = UITableViewCellAccessoryNone;
[_selectedRowDictionary removeObjectForKey:[NSString stringWithFormat:#"row%d", indexPath.row]];
NSLog(#"row selected > 3, row%d not selected", indexPath.row);
}
}
Am I missing something that is causing the cell to be deselected again when I scroll down the tableview?
When I NSLog the dictionary, it says that those rows exist and have been selected
I have checked similar questions but, I thought I solved the cell recycling issue already.
Are you at liberty to use a mutable array instead?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:#"identifer" forIndexPath:indexPath];
if ([_selectedRowArray containsObject:indexPath])
cell.accessoryType = UITableViewCellAccessoryCheckmark;
else
cell.accessoryType = UITableViewCellAccessoryNone;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if ([_selectedRowArray containsObject:indexPath]) {
[_selectedRowArray removeObject:indexPath];
} else {
if (_selectedRowArray.count < 3)
[_selectedRowArray addObject:indexPath];
else {
// Don't select it
}
}
[tableView reloadData];
}
I am editing your code, try this code.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:#"identifer" forIndexPath:indexPath];
BOOL isRowSelected = [[_selectedRowDictionary valueForKey:#(indexPath.row)] boolValue]
if (isRowSelected) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
} else {
cell.accessoryType = UITableViewCellAccessoryNone;
}
return cell;
}
Code changes in --didSelectRowAtIndexPath
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
if (cell.accessoryType == UITableViewCellAccessoryCheckmark) {
cell.accessoryType = UITableViewCellAccessoryNone;
if (_selectedRowDictionary) {
[_selectedRowDictionary removeObjectForKey:#(indexPath.row)];
NSLog(#"row %d removed from array", indexPath.row);
}
} else {
if (_selectedRowDictionary.count == 3) {
// Don't allow for Selection
return;
}
cell.accessoryType = UITableViewCellAccessoryCheckmark;
[_selectedRowDictionary setValue:#(YES) forKey:#(indexPath.row)];
}
}
User has to unselect the previous selected row to select new row. I edited your code in optimised way, I hope this code works for you.
I am trying to implement multiselection in table view. But it is not working. When I add the below code it just shows me the single section for the elements in the table view. When I remove this line from code then I am able to select but not able to deselect the items.
Removed line code:multi selection works but not able to deselect
for (i=0; i<[arr_selectedCells count]; i++) {
NSInteger currentValue = [(NSNumber *)[arr_selectedCells objectAtIndex:i] integerValue];
if (currentValue==indexPath.row) {
cell.accessoryType=UITableViewCellAccessoryCheckmark;
}
}
correct.
Code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
UserFriend *user_friend=[arr_userFriends objectAtIndex:indexPath.row];
cell.textLabel.text=user_friend.name;
NSLog(#"name is %#",user_friend.name);
int i;
for (i=0; i<[arr_selectedCells count]; i++)
{
NSInteger currentValue = [(NSNumber *)[arr_selectedCells objectAtIndex:i]integerValue];
if(currentValue==indexPath.row)
{
cell.accessoryType=UITableViewCellAccessoryCheckmark;
}
else
{
cell.accessoryType=UITableViewCellAccessoryNone;
}
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if(![arr_userFriends containsObject:[NSNumber numberWithInteger:indexPath.row]])
{
[arr_selectedCells addObject:[NSNumber numberWithInteger:indexPath.row]];
}
else
{
[arr_selectedCells removeObject:[NSNumber numberWithInteger:indexPath.row]];
}
NSLog(#"numr is %ld",(long)indexPath.row);
[tableView reloadData];
}
Please tell me where I am going wrong?
i just edited your code! and i hope it works for you
tableView CellForRowAtIndexPath
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
UserFriend *user_friend=[arr_userFriends objectAtIndex:indexPath.row];
cell.textLabel.text=user_friend.name;
if([arr_selectedCells containsObject:user_friend.name])
cell.accessoryType = UITableViewCellAccessoryCheckmark;
else
cell.accessoryType = UITableViewCellAccessoryNone;
return cell;
}
didSelectRowAtIndexPath
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UserFriend *user_friend=[arr_userFriends objectAtIndex:indexPath.row];
if([arr_selectedCells containsObject:user_friend.name])
{
[arr_selectedCells removeObject:user_friend.name];
}
else
{
[arr_selectedCells addObject:user_friend.name];
}
[tableView reloadRowsAtIndexPaths:#[indexPath] withRowAnimation:UITableViewRowAnimationNone];
}
try these
tableView.allowsSelection=YES;
tableView.allowsSelectionDuringEditing = YES;
i need to add checkmark when we tap on each cell, and it must show when i return back to tableview.
I tried with this code but its not working,
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
if (self.thread == nil) {
cell.textLabel.text = #"Loading, please wait...";
} else if ([self.thread count] == 0) {
cell.textLabel.text = #"No Results!";
} else {
//
NSDictionary *msg = [self.thread objectAtIndex:indexPath.row];
NSLog(#"yourMutableDictionary - %#",msg);
if (indexPath.row == 0) {
cell.textLabel.text = [thread objectAtIndex:0];
} else {
cell.textLabel.text = [NSString stringWithFormat:#"%# ", [msg objectForKey:#"id"]];
if ([self.idSelected count] != 0) {
if ([self.idSelected containsObject:[NSString stringWithFormat:#"%#", [msg objectForKey:#"id"]]]) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
}
}
}
return cell;
}
#pragma mark - Table view delegate
//In a xib-based application, navigation from a table can be handled in - tableView:didSelectRowAtIndexPath:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)path
{
if (self.thread == nil || self.thread.count == 0) {
return;
}
UITableViewCell *cell = [tableView cellForRowAtIndexPath:path];
if (path.row == 0) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;// this checkmark not working
}
else {
NSDictionary *user = [self.thread objectAtIndex:path.row];
NSString *uName = [NSString stringWithFormat:#"%# %#", [user objectForKey:#"first_name"], [user objectForKey:#"last_name"]];
NSString *uId = [NSString stringWithFormat:#"%#",[user objectForKey:#"id"]];
NSLog(#" click id%#", uId);
if (cell.accessoryType == UITableViewCellAccessoryCheckmark) {
[userNames removeObject:uName];
[userIds removeObject:uId ];
cell.accessoryType = UITableViewCellAccessoryNone; // this check mark is working perfectly
} else {
[userNames addObject:uName];
[userIds addObject:uId];
cell.accessoryType = UITableViewCellAccessoryCheckmark; // this check mark is working perfectly
}
}
}
first cell check mark is not working but others working perfectly. I want to add check mark on first cell too, how its possible
Use below code to display checkmark on multiple table view cell :
- (void)viewDidLoad
{
[super viewDidLoad];
self.arraySelectedCell = [NSMutableArray array];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([self.arraySelectedCell containsObject:indexPath])
{
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
else
{
cell.accessoryType = UITableViewCellAccessoryNone;
}
// do here..
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
//the below code will allow multiple selection
if ([self.arraySelectedCell containsObject:indexPath])
{
[self.arraySelectedCell removeObject:indexPath];
}
else
{
[self.arraySelectedCell addObject:indexPath];
}
[tableView reloadData];
}
happy coding!
Plz anyone tell me how i select the row at one time with checkmark while other row are not checkmark.I tried but in my case there is mutiple row selected with checkmark. Basically I want to save one row with checkmark when i select another row then previous row deselect and this row select with checkmark. Here is my Code
- (NSString *)getKeyForIndex:(int)index
{
return [NSString stringWithFormat:#"KEY%d",index];
}
- (BOOL) getCheckedForIndex:(int)index
{
if([[[NSUserDefaults standardUserDefaults] valueForKey:[self getKeyForIndex:index]]boolValue]==YES)
{
return YES;
}
else
{
return NO;
} }
- (void) checkedCellAtIndex:(int)index
{ BOOL boolChecked = [self getCheckedForIndex:index];
[[NSUserDefaults standardUserDefaults] setValue:[NSNumber numberWithBool:!boolChecked] forKey:[self getKeyForIndex:index]];
[[NSUserDefaults standardUserDefaults] synchronize];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return List.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *subviewCells = #"Cells";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:subviewCells];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:subviewCells];
}
cell.textLabel.text = [List objectAtIndex:indexPath.row];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:NO];
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
[self checkedCellAtIndex:indexPath.row];
if([self getCheckedForIndex:indexPath.row]==YES)
{
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
else
{
cell.accessoryType = UITableViewCellAccessoryNone;
}
selectLanguage = [List objectAtIndex:indexPath.row];
}
-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
[self checkedCellAtIndex:indexPath.row];
if([self getCheckedForIndex:indexPath.row]==NO)
{
cell.accessoryType = UITableViewCellAccessoryNone;
}
else
{
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
selectLanguage = [List objectAtIndex:indexPath.row];
}
#end;
Try this :
Single Row Selection:
create a new variable to track the index In Controller:
int selectedIndex;
in UITableView cellForRowAtIndexPath method:
if(indexPath.row == selectedIndex)
{
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
else
{
cell.accessoryType = UITableViewCellAccessoryNone;
}
and in UITableView didSelectRowAtIndex method:
selectedIndex = indexPath.row;
[tableView reloadData];
2 way as per you want:
.h file:
NSIndexPath* checkedIndexPath;
#property (nonatomic, retain) NSIndexPath* checkedIndexPath;
.m file:
#synthesize checkedIndexPath;
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
//do you stuff here
if([self.checkedIndexPath isEqual:indexPath])
{
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
else
{
cell.accessoryType = UITableViewCellAccessoryNone;
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//do work for checkmark
if(self.checkedIndexPath)
{
UITableViewCell* uncheckCell = [tableView
cellForRowAtIndexPath:self.checkedIndexPath];
uncheckCell.accessoryType = UITableViewCellAccessoryNone;
}
if([self.checkedIndexPath isEqual:indexPath])
{
self.checkedIndexPath = nil;
}
else
{
UITableViewCell* cell = [tableView cellForRowAtIndexPath:indexPath];
cell.accessoryType = UITableViewCellAccessoryCheckmark;
self.checkedIndexPath = indexPath;
}
}
Happy coding!!