ここに私のコード:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"] autorelease];
}
UIImage *myImage = [UIImage imageNamed:@"flower.png"];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, cell.frame.size.width, cell.frame.size.height)];
imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
imageView.contentMode = UIViewContentModeScaleAspectFit;
imageView.image = myImage;
[cell.contentView addSubview:imageView];
[imageView release];
return cell;
}
commitEditingStyle 関数を実装した後、ナビゲーション バーの左側にある編集ボタンをクリックすると、画像が右に移動します。画像を各セルの中央に表示し、削除アイコンが表示されたときに移動しないようにします。どうやってやるの?ありがとう。