Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

steve1717

macrumors newbie
Original poster
Jul 18, 2007
20
0
I am encountering an issue with the iPhone SDK where some UIImages show up as fuzzy/blurry and others do not. They are all created from .PNG files and I can't seem to isolate why some are blurry and others are not. At first I thought it was just smaller images (50 x 50px or less) but after some testing, I am not so sure any more. Has anyone run into this issue and/or know what I am running in to here? Thanks!:confused:
 

lucasgladding

macrumors 6502
Feb 16, 2007
319
1
Waterloo, Ontario
You may want to check the frames for the UIImages first. Frames are specified with float values rather than integers. If you have fractions, everything will seem blurry. If this is the case, use ceil(), floor(), or round() on the values before assigning the frame.

This is my first guess, so don't spend too much time on it. That said, this has come up in my own apps once or twice.
 

steve1717

macrumors newbie
Original poster
Jul 18, 2007
20
0
Thanks for the tip. I performed quite a few different tests on that theory but ultimately the frame is determined by:

0.0, 0.0, myImage.size.width, myImage.size.height

Therefore, the sizes should be exact floats. Even when manually entering the sizes, I get the same blurry image.

I've tried re-saving the culprit PNG's numerous times in all different sizes but I'm just getting erratic results.
 

steve1717

macrumors newbie
Original poster
Jul 18, 2007
20
0
Does this blurry UIImage issue occur just in the iPhone Simulator? I am hoping that this issue is confined to the simulator and does not actually appear while running on the iPhone.:confused:
 

stadidas

macrumors regular
Feb 27, 2006
243
0
Kent, United Kingdom
I just looked at the revision history for the UICatalog app on the iPhone Dev centre, and one of the update points was "fixed bad blur effect on UIView classes by properly rounding of coordinates". Maybe that is related to your issue?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.