I have one table view in which i am displaying some record. And navigte to second view, in second view controller we have four options as primary, secondary, tertia, quatrnary. when user select any of this optin it will navigate to back and selected cell color will change.
All option is working well. but i stuck at following issue as,
suppose user select first cell and set this as pri, it will navigate back and color will be red, BUT when user slected another cell (supoose 5 cell) and again set as primary then cell 1 will remaining same as red. i dont want this. at a time user will set noly one record as pri/sec/ter/quaternary.
How i will manage this?? Tried to relaod table data, but not working?? while navigating back i am using below code in viewwill appear
if (singltong.primary == indes) {
[tbleMasjidnames cellForRowAtIndexPath:tableSelection].backgroundColor = [UIColor colorWithRed:13.0f/255.0f green:159.0f/255.0f blue:78.0f/255.0f alpha:1.0f];
}
else if (singltong.secondary == indes){
[tbleMasjidnames cellForRowAtIndexPath:tableSelection].backgroundColor = [UIColor colorWithRed:255.0f/255.0f green:33.0f/255.0f blue:59.0f/255.f alpha:1.0f];
}
else if (singltong.tertiary == indes){
[tbleMasjidnames cellForRowAtIndexPath:tableSelection].backgroundColor = [UIColor colorWithRed:23.0f/255.0f green:153.0f/255.0f blue:221.0f/255.0f alpha:1.0f];
}
else if (singltong.quaternary == indes){
[tbleMasjidnames cellForRowAtIndexPath:tableSelection].backgroundColor = [UIColor colorWithRed:255.0f/255.0f green:150.0/255.0 blue:23.0f/255.0f alpha:1.0f];
}
//********************Cell for row****************
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"MasjidCell"; // Custom cell for masjid Name
MasjidListCell *cell = (MasjidListCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell.backgroundColor = [UIColor greenColor];
if (cell == nil){
NSArray *nib=[[NSBundle mainBundle] loadNibNamed:@"MasjidCell" owner:self options:nil];
cell = nib[0];
}
cell.selectionStyle=UITableViewCellSelectionStyleNone;
//if search is on then get data from search result array else from shared instance
if (_isSearchOn) {
if ([searchResults count]==0) {
cell.lblMasjidName.text=@"No Record Found.";
}
else{
cell.lblMasjidName.text = [searchResults objectAtIndex:indexPath.row];
}
}
else{
cell.lblMasjidName.text = singltong.MasjidNames[indexPath.row];
cell.lblLocalArea.text = singltong.masjidLocalArea[indexPath.row];
cell.lblCountry.text = singltong.masjidCountry[indexPath.row];
}
return cell;
}//end of method