1

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?

4

2 回答 2

2

我知道这是一个已经回答的老问题,但由于接受的答案非常不清楚,因为这可能会帮助其他与您有相同问题的人:

鉴于您从墙上拉下的图像在显示之前已转换为 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);
于 2012-06-10T20:25:31.130 回答
-1

当您调用GraphAPI 照片对象时,您会在响应中获得尺寸:https ://graph.facebook.com/98423808305

你在找什么?

于 2012-05-09T10:36:43.303 回答