これは私が最近気づいた奇妙なことです。次のコードでaccessoryTypeを設定した後でも、UITableViewセルのアクセサリタイプが表示されません
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"LocationCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier: CellIdentifier] autorelease];
}
if (indexPath.section == 0) {
cell.textLabel.text = @"Move to a New Location";
}else{
cell.textLabel.text = [self.locArray objectAtIndex:indexPath.row];
}
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
return cell;
}
どんなアクセサリータイプを設定しても構いません。セルには常にテキストラベルのみが表示されますが、ボタンは表示されません。私は何かが足りないのですか?UITableViewCellを使用するのはこれが初めてではないことに注意してください。私はこれまでこの問題に遭遇したことがありません。その間、私はこれをiOS6でテストしており、iPadシミュレーターとそれ自体のデバイスの両方でこの動作を確認しました。