My code is currently able to change the background of a label I have. The label gets updated from a server and may return labels inconsistently and as a sentence instead of a single word. Is there a way to change if(@"%@",[cell.lblStatus.text isEqual: @"Full"])
to something where if the label contains a word?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:
(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
MartaViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier
forIndexPath:indexPath];
Object *currentHotel = [self.objectHolderArray
objectAtIndex:indexPath.row];
cell.lblStation.text = currentHotel.station;
cell.lblStatus.text = currentHotel.status;
NSLog(@"%@", cell.lblStatus.text);
if(@"%@",[cell.lblStatus.text isEqual: @"Full"])
cell.lblStatus.backgroundColor = [UIColor redColor];
else
cell.lblStatus.backgroundColor = [UIColor greenColor];
return cell;
}