开发者

Contents of UIPopoverController are blurry

开发者 https://www.devze.com 2023-03-06 10:49 出处:网络
I am presenting a UIPopoverController in my application but the content view is appearing slightly blurred.

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:

Contents of UIPopoverController are blurry

Code:

// ...    

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

// init popover with editSOViewController
UIPopoverController *popover = [[UIPopoverCo开发者_如何学Gontroller 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.


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.

0

精彩评论

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

关注公众号