У меня есть 2 вида таблицы Я хочу настроить стиль ячейки второго представления в зависимости от выбранной строки в первом представлении таблицы. он работает при настройке аксессуаров, но он не подходит для стиля. Я с помощью IOS 7.1 и Xcode 5.1 , как я использую следующий кодUITableView Изменение стиля ячейки
заранее спасибо
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *TableIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:TableIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:TableIdentifier];
}
cell.detailTextLabel.textColor = [UIColor lightGrayColor];
cell.textLabel.text = [array objectAtIndex:indexPath.row];
if ([selectedRow isEqualToString:@"Cars"]) {
[cell setAccessoryType: UITableViewCellAccessoryDetailButton];
}
if ([selectedRow isEqualToString:@"Houses"]) {
NSArray *temp = [[dic objectForKey:selectedRow]valueForKey:@"Job"];
cell.selectionStyle = UITableViewCellStyleSubtitle;
cell.detailTextLabel.adjustsFontSizeToFitWidth = YES;
cell.detailTextLabel.text = [temp objectAtIndex:indexPath.row];
}
if ([selectedRow isEqualToString:@"Libraries"]) {
cell.selectionStyle = UITableViewCellStyleValue1;
}
return cell;
}