2011-07-23 4 views
0

Почему «detailTextLabel» больше не работает?UITableView detailTextLabel - разработка iphone

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *CellIdentifier = @"Cell"; 

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
    if (cell == nil) { 
     cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; 
    } 

    // Configure the cell. 
    cell.textLabel.text=[listData objectAtIndex:[indexPath row]]; 
    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator; 


    [email protected]"hi"; 
    return cell; 
} 
+0

попытаться отправить больше кода ... – Aravindhan

+0

я сделал, любая помощь? –

ответ

7

Попробуйте изменить стиль ячейки, используйте этот код при инициализации ячейки

cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle 
            reuseIdentifier:CellIdentifier] autorelease]; 

Для получения дополнительной информации о стилях ячейки посмотреть на apple's class reference

+1

безупречный! Спасибо. –

2

Вы выбрали cell style UITableViewCellStyleDefault, который не поддерживает detailTextLabel

Попробуйте использовать другой стиль.

редактировать

Вы выбираете стиль в методе initWithStyle:reuseIdentifier;. Взгляните на документы UITableViewCell, в которых описаны доступные стили ячеек.

+0

как я могу это сделать? программно или от IB? –

Смежные вопросы