Visualización de la imagen del perfil de FB del usuario que ha iniciado sesión en la celda UITableView

I am a new one to facebook integration. After I've gone through so many tutorials I've understood something from facebook SDK.

Por favor ayúdame con esto.

- (void)apiGraphMe
{
 currentAPICall = kAPIGraphMe;
 AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
 NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                               @"name,picture",  @"fields",
                               nil];
 [[delegate facebook] requestWithGraphPath:@"me" andParams:params andDelegate:self];
}

- (void)request:(FBRequest *)request didLoad:(id)result
{
NSLog(@"result is------------%@",result);
if ([result isKindOfClass:[NSDictionary class]])
{
    NSLog(@"id is: %@", [result objectForKey:@"id"]); 
    NSString *idValue = [result objectForKey:@"id"];
}
}

In above code I am getting URL of loggedIn user profile pic. My wish is to display that url image into tableView cell.

I think directly passing that url image to tableview cell's imageview is not correct way. If
we pass the id of the user based on that we can get profile pic. Because it reduces the complexity if other user logged in.

Hope you understand the problem and context. Kindly excuse me if any grammer or english language mistakes are there.

Thanks alot for any help and replies in advance.

preguntado el 28 de agosto de 12 a las 12:08

Please help me anybody regarding this....:):) -

Don't ask same kind of question multiple times,just update the question. stackoverflow.com/questions/12093323/… -

am updated my question @Born Survivior.but no one is responding to that question.thats why i asked newly.sorry for my mistake. a -

Yeah,but according to previos link,you are getting the image,so why don't you use that image directly? -

That's what I am answering to your question,you have received image,in that previous question,so why don't you display in cell using ,cell.imageView.image -

1 Respuestas

here are the steps to show user/friends profile image in tableview

  • you already have user/friends ids

  • declare IBOutlet FBProfilePictureView *userProfileImage; // make sure you import FacebookSDK/FacebookSDK.h

  • in your IB/Storeyboard tableview cell, drag a UIView (width 36, height 36)

  • change the class of this uiview (in identity inspector to FBProfilePictureView)

  • connect your iboutlet above to this FBProfilePictureView

  • in cellForRowAtIndexPath, assign image as below

  • (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"FriendsCell";

    FriendsCell cell = (FriendsCell)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    cell.userProfileImage.profileID = objUD.userID; return cell; }

Note: I am assuming you have a custom UITableViewCell class called FriendsCell

In viewDidLoad method, write the below line [FBProfilePictureView class];

Respondido el 01 de Septiembre de 12 a las 02:09

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.