を使用してオプションメニューを作成しましたUITableViewController
が、ラベルを正しく設定できますが、画像は設定できません。
switchステートメントを取り出して、に基づいた正しい値で満たされた配列を使用しようとしましたが、[indexPath row]
正しく機能させることもできませんでした。
何か案は?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:CellIdentifier];
}
switch ([indexPath row]) {
case 0:
[[cell imageView] setImage:[UIImage imageNamed:@"42-photos.png"]];
[[cell textLabel] setText:@"Photos"];
break;
case 1:
[[cell imageView] setImage:[UIImage imageNamed:@"280-clapboard.png"]];
[[cell textLabel] setText:@"Videos"];
break;
case 2:
[[cell imageView] setImage:[UIImage imageNamed:@"42-info.png"]];
[[cell textLabel] setText:@"About"];
break;
default:
return cell;
break;
}
return cell;
}