If your cells are bound to Entities in a Database, you have to run a logic in the priority selection controller where after the selection, other objects with this priority are set back or act like you want. If you use the NSFetchedResultsController
, your data is hold up-to-data and you can do a default handling in the cellForRowAtIndexpath
method
if ([entity.prio intValue] == 1)
{
// set your cell settings
}
all of your affected cells have to be updated, so maybe a [tableView reloadData];
in viewWillAppear
will help
update:
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[tbleMasjidnames reloadData];
// ...
}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
// ... get/create cell 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];
switch(indexPath.row)
{
case singltong.primary:
cell.backgroundColor = [UIColor colorWithRed:13.0f/255.0f green:159.0f/255.0f blue:78.0f/255.0f alpha:1.0f];
break;
case singltong.secondary:
cell.backgroundColor = [[UIColor colorWithRed:255.0f/255.0f green:33.0f/255.0f blue:59.0f/255.f alpha:1.0f];
break;
// ...
default:
cell.backgroundColor = [UIColor whiteColor]; // or other default
break;
}
}
}
but you still have to implement correct handling logic in your singltong
class to make this working.