我需要將圖像從一個視圖傳遞到另一個視圖。在第一個視圖中,我從服務URL獲取base64數據,並將其轉換爲特定圖像並顯示在tableviewcell.Now中,當我點擊特定單元格時,相應的圖像應的firstView傳遞給secondView.But無法得到it.getting錯誤「計劃接收信號SIGABRT」在xcode中將圖像從一個視圖傳遞到另一個視圖?
這是代碼我米工作:
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];
}
我怎樣才能得到它?