Может ли кто-нибудь объяснить следующее явление?
Начиная с iPhone Device 3.1 SDK, я обнаружил, что если UITableViewCell
имеет стиль UITableViewCellStyleValue1
и его detailTextLabel.text
не назначено, то textLabel
не отображается в центре ячейки как можно было ожидать.
Одна заметная оговорка заключается в том, что это происходит только для меня, когда я тестирую на устройстве 1012 * - iPhone Simulator 3.1 SDK правильно отображает ячейки. Кроме того, это не проблема при использовании iPhone Device 3.0 SDK.
Ниже приведена простая реализация подкласса UITableViewController
, демонстрирующая проблему.
@implementation BuggyTableViewController
#pragma mark Table view methods
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 3;
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
}
switch (indexPath.row) {
case 0:
cell.textLabel.text = @"detailTextLabel.text unassigned";
break;
case 1:
cell.textLabel.text = @"detailTextLabel.text = @\"\"";
cell.detailTextLabel.text = @"";
break;
case 2:
cell.textLabel.text = @"detailTextLabel.text = @\"A\"";
cell.detailTextLabel.text = @"A";
break;
default:
break;
}
return cell;
}
@end