我正在尝试获取头像并在 iOS 中全屏显示
尝试使用对象 FBProfilePictureView,我似乎无法自定义图像的大小,它始终是相同的最大大小 如果我尝试使用其他配置文件 ID 更改图像,我会为不同的配置文件获得不同的尺寸
也试过
uPhoto.pictureCropping = FBProfilePictureCroppingSquare;
但这并没有让事情变得更好
我应该使用 UIImageView 并从这样的 URL 加载数据吗 https://graph.facebook.com/someuser/picture?width=XXX&height=YYY
或者有更好的选择吗?
最佳答案
FBProfilePictureView 在其实现中分配了一个 UIImageView。您无法在 FBProfilePictureView 上设置任何会改变其缩放 UIImageView 方式的内容。所以,是的,您可以分配自己的 UIImageView 并加载 URL。获取 URL 的正确方法是这样的:
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;
这是改编 self 更新的 FBProfilePictureView 版本... DBFBProfilePictureView这是基于 Facebook 的原创。
关于ios - Facebook 全屏图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20777266/