Right now with the Facebook iOS sdk, I am pulling images off the wall. but I need to analyze the photo and determine the height and width of the photo.
How would I go about doing this?
Right now with the Facebook iOS sdk, I am pulling images off the wall. but I need to analyze the photo and determine the height and width of the photo.
How would I go about doing this?
我知道这是一个已经回答的老问题,但由于接受的答案非常不清楚,因为这可能会帮助其他与您有相同问题的人:
鉴于您从墙上拉下的图像在显示之前已转换为 UIImage 对象,那么您只需执行以下操作即可轻松获取每个对象的高度和宽度:
完整代码示例:
NSData* imageData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:yourimageurlhere]];
UIImage* image = [[[UIImage alloc] initWithData:imageData] autorelease];
[imageData release];
NSLog(@"Height : %0.1f", image.size.height);
NSLog(@"Width : %0.1f", image.size.width);
当您调用GraphAPI 照片对象时,您会在响应中获得尺寸:https ://graph.facebook.com/98423808305
你在找什么?