Contents of UIPopoverController are blurry
Asked Answered
C

1

5

I am presenting a UIPopoverController in my application but the content view is appearing slightly blurred.

To demonstrate, I placed a second instance of the content view controller directly onto self.view and it is easy to see by comparison that the text in the popover is fuzzy. This issue occurs both on the device and in the Simulator.

Screenshot:

enter image description here

Code:

// ...    

// init the edit view controller
editSOViewController = [[EditViewController alloc] 
initForNewObjectWithDict:dict];

// init popover with editSOViewController
UIPopoverController *popover = [[UIPopoverController alloc] 
initWithContentViewController:editSOViewController];

// set size
navPopover.popoverContentSize = 
CGSizeMake(editSOViewController.view.frame.size.width, 
[editSOViewController heightForViewControllerInPopoverView]);  

// this is blurry
[popover presentPopoverFromRect:image.frame
                            inView:self.view
          permittedArrowDirections:UIPopoverArrowDirectionAny
                          animated:YES];

// this is clear
editViewController *test =
 [[EditViewController alloc] initForNewObjectWithDict:dict];
[self.view addSubview:test.view];

Any ideas for what could cause this? I thought that the UIPopover might be slightly shrinking the view, but I lined the two examples up with an image editor and there is no difference in size (but distinct "fuzz" in the popover view).

I still have the same problem if i use WEPopover (https://github.com/werner77/WEPopover/).

Thanks.

Carissacarita answered 16/5, 2011 at 13:53 Comment(3)
Are you using any -setCenter method for any view?Guv
NSLog the value of image.frame. Does it have any fractional parts?Elisavetgrad
@Anna Karenina CGRect f =floatingImageView.frame; NSLog(@"x: %f, y:%f, w:%f, h%f",f.origin.x, f.origin.y, f.size.width, f.size.height); x: 336.707764, y:450.813629, w:60.000000, h39.000000Carissacarita
E
9

Using frame values with fractional parts causes positioning in-between pixels which results in blurriness.

To avoid it, set the frame values to numbers with no fractions by using functions such as round or floor.

Elisavetgrad answered 16/5, 2011 at 21:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.