あるビューから別のビューに画像を渡す必要があります。firstView では、サービス URL から base64 データを取得し、それを特定の画像に変換して tableviewcell に表示しました。特定のセルをタップすると、対応する画像が表示されます。 firstView から secondView に渡されましたが、取得できませんでした。エラー「Program received signal SIGABRT」を取得できませんでした
これは私が取り組んでいるコードです:
FirstView.m
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSData *data = [NSData dataFromBase64String:yBase64String];
UIImage* image = [UIImage imageWithData: data];
UIImageView *myImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,10,90,150)];
myImageView.tag = 120;
myImageView.image = image;
[cell addSubview:myImageView];
[myImageView release];
return cell;
}
- (void) tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
SecondView *scnd = [[SecondView alloc] initWithNibName:@"SecondView" bundle:nil];
UIImage *image=(UIImage *)[cell viewWithTag:120];
scnd.provImage=pImage;
[self presentModalViewController: scnd animated:NO];
}
SecondView.m
-(void)viewDidLoad
{
[super viewDidLoad];
UIImageView *myImageView = [[UIImageView alloc] initWithFrame:CGRectMake(2,25,90,80)]; //getting error at this line
myImageView.image= self.provImage;
[self.view addSubview: myImageView];
[ myImageView release];
}
どうすれば入手できますか?