我的 uitableview 中有一个来自 Facebook 的名称列表,当用户选择一行时,用户详细信息应显示在另一个视图中。
在我的朋友.m
- (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");
}
}
这很好,因为如果我在表格视图下方放置一个 uiiamgeview 以查看它是否有效,似乎我得到了它有效的正确图像。
但是当我选择该行并尝试在以下几行中将图像发送到其他视图控制器 UIImageview
FriendDetail *profileDetailPicture = [[FriendDetail alloc] initWithNibName: @"FriendDetail" bundle: nil];
profileDetailPicture.profileImage.image= transferImage.image;
profileDetailPicture.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:profileDetailPicture animated:YES];
它不会将图像发送到应出现朋友图像的详细视图控制器
我尝试了 UIImageView 和 UIImage 方法,但无法完成。
代码有什么问题?
- - - - -编辑 - - - - -
所以感谢回答我已经更改了代码,下面的代码工作正常
-(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];
}