我在facebook图形API上工作。我已经准备好了使用我的应用的用户的ID。我可以显示用户的id和我想要做的事情,它显示在我的tableview的每个单元格中,一个好用户的FBProfilePictureView。在桌面视图中显示一些Facebook好友(带ID)的个人资料图片
[[FBRequest requestForMe] startWithCompletionHandler:
^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *user, NSError *error) {
if (!error) {}
NSString* fql =
@"SELECT uid FROM user WHERE is_app_user=true AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me())";
[FBRequestConnection startWithGraphPath:@"/fql"
parameters:@{ @"q" : fql}
HTTPMethod:@"GET"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
FBRequest *fql = [FBRequest requestForGraphPath:@"fql"];
[fql.parameters setObject:@"SELECT uid,name,is_app_user FROM user WHERE is_app_user AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me())" forKey:@"q"];
[fql startWithCompletionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
if (result) {
NSArray *arrayRsult = [result objectForKey:@"data"];
NSMutableArray *ids = (NSMutableArray *) [arrayRsult valueForKey:@"uid"];
NSMutableArray *names = (NSMutableArray *) [arrayRsult valueForKey:@"name"];
recentFriends = [[NSMutableArray alloc] init];
idFriends = [[NSMutableArray alloc] init];
for (NSDictionary *c in ids)
{
[idFriends addObject:c];
}
arrayLength = [recentFriends count];
NSLog(@"ids are : %@ ",idFriends);
NSLog(@"there are %i", arrayLength);
我已经媒体链接完成后,就要开始了,在每个单元使用此代码显示我的Facebook的个人资料图片:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
FBProfilePictureView *prof = [[FBProfilePictureView alloc]initWithFrame:CGRectMake(5, 5, 30, 30)];
[[FBRequest requestForMe] startWithCompletionHandler:
^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *user, NSError *error) {
if (!error) {
prof.profileID = [user objectForKey:@"id"];
}
}];
[cell addSubview:prof];
}
我不不使用定制单元格和笔尖来定制单元格。 我不知道如何为这个表创建一个数组。 我试过这个代码cell.imageView.image = [idFriends objectAtIndex:indexPath.row];
(idFriends在.h文件作为__block NSMutableArray的声明) 感谢您的帮助!
好的,谢谢!有没有办法使用FBProfilePictureView而不是cell.image.image在不同的单元格中显示一些朋友个人资料图片? – 2013-05-09 09:30:29
只是通过朋友们的Facebook ID在该网址并获取其图像中的tableview – 2013-05-09 10:13:44
http://graph.facebook.com/147083812025874/picture?type=medium特定的细胞我不能让图像和任何东西。我是新来的ios。所以plz帮我 – Raju 2013-10-31 13:56:47