-2
Mein Code ist derzeit in der Lage, den Hintergrund eines Labels, das ich habe, zu ändern. Das Label wird von einem Server aktualisiert und kann Etiketten inkonsistent und als einen Satz statt eines einzelnen Wortes zurückgeben. Gibt es eine Möglichkeit, if(@"%@",[cell.lblStatus.text isEqual: @"Full"])
in etwas zu ändern, wo das Etikett ein Wort enthält?Gibt es eine Möglichkeit zu verwenden, wenn 'contains' statt isEqual?
- (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;
}