私はどのようにtableviewのすべてのセルの画像を配置するには? IAM
-(UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:CellIdentifier];
itemimageview=[[UIImageView alloc]initWithFrame:CGRectMake(5, 8, 75, 70)];
itemimageview.image=[UIImage imageNamed:@"thumb_mdpi.png"];
itemimageview.userInteractionEnabled = YES;
[cell.contentView addSubview:itemimageview];
return cell;
}
のように、すべてのテーブルビューセルでImageViewのを置き、uは任意の行をクリックしたときに、私たちは、私がdidSelectROwメソッドで以下のコードを記述し、当社のiPhone camera.Forから画像を取得する1 application.Inを開発。
UIImagePickerController *imagePicker = [[[UIImagePickerController alloc] init]
autorelease];
imagePicker.sourceType=UIImagePickerControllerSourceTypeCamera;
//imagePicker.allowsImageEditing = NO;
imagePicker.delegate = self;
[self presentModalViewController:imagePicker animated:YES];
私は
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage* image = [info objectForKey:UIImagePickerControllerOriginalImage];
NSLog(@"image selected");
itemimageview.image =image;
[self dismissModalViewControllerAnimated:YES];
}
ようUIIMagePickerControllerデリゲートメソッドを使用しますが、私の問題は、画像を選択した後であるuは最初の行を選択し、画像を撮るonly.If、そのイメージは、最後のセルに表示されます後その画像は最後の行に表示されます。私のコードで、各行に画像を取得するための変更点は何ですか?
コードにブレークポイントを追加するだけで簡単にチェックできます。または、スイッチケースを使用し、行1をクリックしてからこの画像表示をクリックすると、2行目がこの画像を表示するときのようにコードを書いてください。 – ram