开发者

My iOS Views are off half a pixel?

My graphics are looking blur开发者_如何学JAVAry unless I add or subtract a half pixel to the Y coordinate.

I know this is a symptom that usually happens when the coordinates are set to sub-pixel values. Which leads me to believe one of my views must be off or something.

But I inspected the window, view controller and subviews, and I don't see any origins or centers with sub-pixel values.

I am stumped, any ideas?


See if somewhere you are using the center property of a view. If you assign that to other subviews, depending on their sizes they may position themselves in half pixel values.

Also, if you are using code to generate the UI I would suggest using https://github.com/domesticcatsoftware/DCIntrospect. This tools allows you in the simulator to look at all the geometry of visible widgets. Half pixel views are highlighted in red vs blue for integer coordinates. It helps a lot.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜