Note that there are some explanatory texts on larger screens.

plurals
  1. POSend image to another view controller UIImageView IOS 5.1
    text
    copied!<p>I have a list of names from Facebook in my uitableview , when user select a row user detail should be shown in another view.</p> <p>in my friends.m </p> <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { long long fbid = [[arrayOfIDs objectAtIndex:indexPath.row]longLongValue]; NSString *user=[NSString stringWithFormat:@"%llu/picture",fbid]; [facebook requestWithGraphPath:user andDelegate:self]; FriendDetail *profileDetailPicture = [[FriendDetail alloc] initWithNibName: @"FriendDetail" bundle: nil]; profileDetailPicture.profileImage.image= transferImage.image; profileDetailPicture.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; [self presentModalViewController:profileDetailPicture animated:YES]; [profileDetailPicture release]; } -(void)request:(FBRequest *)request didLoad:(id)result{ if ([result isKindOfClass:[NSData class]]) { transferImage.image = [[UIImage alloc] initWithData: result]; // UIImage * sendPicture=[[UIImage alloc] initWithData: result]; NSLog(@"Profile Picture"); } } </code></pre> <p>This fine because if i put an uiiamgeview below table view to see if it works or not,it seems i get the correct image it works. <img src="https://i.stack.imgur.com/pGSGS.png" alt="enter image description here"></p> <p>but when i select the row and try to send the image to other viewcontroller UIImageview in following lines</p> <pre><code>FriendDetail *profileDetailPicture = [[FriendDetail alloc] initWithNibName: @"FriendDetail" bundle: nil]; profileDetailPicture.profileImage.image= transferImage.image; profileDetailPicture.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; [self presentModalViewController:profileDetailPicture animated:YES]; </code></pre> <p>it doesnt send the image to the detail view controller where friends' image should appear<img src="https://i.stack.imgur.com/gTXMA.png" alt="enter image description here"></p> <p>I tried both UIImageView and UIImage methods but couldnt make it done. </p> <p>Whats wrong with the code?</p> <p>---------EDIT----------</p> <p>So thanks to answer i have changed the code, following code works fine</p> <pre><code>-(void)request:(FBRequest *)request didLoad:(id)result{ if ([result isKindOfClass:[NSData class]]) { transferImage.image = [[UIImage alloc] initWithData: result]; FriendDetail *profileDetailPicture = [[FriendDetail alloc] initWithNibName: @"FriendDetail" bundle: nil]; [profileDetailPicture view]; profileDetailPicture.profileImage.image= transferImage.image; profileDetailPicture.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; [self presentModalViewController:profileDetailPicture animated:YES]; [profileDetailPicture release]; NSLog(@"Profile Picture"); } } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { long long fbid = [[arrayOfIDs objectAtIndex:indexPath.row]longLongValue]; NSString *user=[NSString stringWithFormat:@"%llu/picture",fbid]; [facebook requestWithGraphPath:user andDelegate:self]; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload