UITableViewのcellのスタイルを変える

デフォルトでも大きく4つスタイルがあって、それに加えて矢印つけたりできる。
いろいろいじってみて、今は以下のように設定している。セルの名前は”CustomCell”。

[php]
– (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *CellIdentifier = @"CustomCell";

//styleはValue1を設定
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
//cellに矢印追加
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

//cellにデータを送る
cell.textLabel.text = [self.aryTitle objectAtIndex:indexPath.row];

return cell;
}
[/php]

こちらを参考にさせて頂きました。
[iOS]UITableViewCellのプリセットビュー – l4l

コメント

タイトルとURLをコピーしました