开发者

UIImage: strange issue with size

Im trying to download "profile_image_url" images (.jpg) from twitter and display them in my app. Im trying to resize any images that are not what I'm expecting them to be. In the process of debugging an issue, I ran into this strange behavior.

Code:

NSLog(@"%d  %d  %d  %d",48,image.size.width,image.size.height,48);

Prints:开发者_运维知识库

2010-02-09 13:26:43.925 MyApp[00000:0000] 48  0  1078460416  0

It appears that the height and width is not printing properly and also causes the second "48" not to print. What is going on here?

BTW, the UIImage displays fine I just cannot resize the image properly if i cannot get the width and height.


%d is for integers. Use %f for printing floats (which is what the CGSize members are).


image.size is a CGSize which stores width and height as floats, not ints. So use %f in your format string instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜