UIPopoverController 的内容模糊
我在我的应用程序中呈现一个 UIPopoverController 但内容视图显得有点模糊。
为了演示,我将内容视图控制器的第二个实例直接放置在 self.view 上,通过比较很容易看出弹出窗口中的文本是模糊的。此问题同时出现在设备和模拟器中。
屏幕截图:
代码:
// ...
// 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];
任何想法会导致这个吗?我认为 UIPopover 可能会稍微缩小视图,但我使用图像编辑器将两个示例对齐,大小没有差异(但弹出视图中明显“模糊”)。
如果我使用 WEPopover (https://github.com/werner77/WEPopover/)。
谢谢。
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:
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用带有小数部分的帧值会导致定位在像素之间,从而导致模糊。
为了避免这种情况,请使用诸如
round
或floor
等函数将帧值设置为不带分数的数字。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
orfloor
.