Reputation: 11
I've added some UIImageViews with png images to my view, using interface builder. Initially they are added off-screen.
Later, I animate them onto the screen with CoreAnimation, like so:
[UIView beginAnimations:@"slide" context:nil];
[UIView setAnimationDuration:0.1f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDelegate:self];
image.frame = CGRectMake(81+1, 390, 150, 80);
[UIView commitAnimations];
Once they appear onscreen, they look really blurred or fuzzy.
I've heard of this happening before. Does anyone have any idea how to fix it?
Upvotes: 1
Views: 722
Reputation: 650
Quick fix: Re-order the object in the Objects pane on the left, i.e. send backward, then send forward again. Not sure why this happens, but it fixes it for me.
Upvotes: 2
Reputation: 14894
UIImageViews and other views can appear blurry in Interface Builder (and in your iPhone app) if the images are, as camdez suggests, not at rounded pixel locations. Fixing this can be tricky because Interface Builder will only display the numbers in the inspector as integers. However, let's say you have configured the "Origin" widget in the "View" inspector to allow you to specify the X and Y of the center of the view, rather than the top left. If your blurry view is centered at 100,100 and is 35 pixels high, Interface Builder will internally compute the top left corner of the view as (100-35/2) = 82.5 and write it to your XIB file as a decimal.
The quick fix: Change the "Origin" widget back to the "Top Left" setting. Move the view within the canvas so that the pixel values are changed, and then type the correct values back in. Problem solved!
Upvotes: 0
Reputation: 1644
Usually this means that you are positioning the views at fractional pixel values (e.g. 100.5). Make sure you round the coordinates of the position.
Upvotes: 3