Question

I'm trying to get a profile picture and show it in full screen in iOS

Tried using the object FBProfilePictureView, I can't seem to be able to customize the size of the image, it's always the same maximum size If I try changing the image with other profileIDs, I get different sizes for different profiles

Also tried

uPhoto.pictureCropping = FBProfilePictureCroppingSquare;

But it doesn't make anything better

Should I be using an UIImageView and load the data from a URL like this https://graph.facebook.com/someuser/picture?width=XXX&height=YYY

Or are there better options ?

Was it helpful?

Solution

FBProfilePictureView allocates a UIImageView in its implementation. There is nothing you can set on FBProfilePictureView that will change the way it scales the UIImageView. So, yes you could allocate your own UIImageView and load a URL. The correct way to get the URL is like this:

NSDictionary *imageQueryParam = @{@"type":@"large"};
NSString *graphPath = [NSString stringWithFormat:@"%@/picture",self.profileID];
FBRequest *fbRequest = [[FBRequest alloc] initWithSession:nil graphPath:graphPath parameters:imageQueryParam HTTPMethod:nil];
FBRequestConnection *requestConnection = [[FBRequestConnection alloc] init];
[requestConnection addRequest:fbRequest completionHandler:nil];
NSURL *url = requestConnection.urlRequest.URL;

This is adapted from my updated version of FBProfilePictureView... DBFBProfilePictureView which was based on Facebook's original.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top