加载时 UIView 视图扭曲
我有一个 UIScrollView,其中包含一个 UIView,我正在使用 CGPaths 在其上绘制一个相当复杂的图形。视图加载完成后,图形会发生扭曲,因为它在水平和垂直方向上被拉长。如果我重画它,它看起来很正常。
关于造成这种情况的原因以及如何解决它有什么想法吗?
I have a UIScrollView that contains a UIView onto which I am drawing a rather complex graphic using CGPaths. After the view finishes loading the graphic is distorted in that it is elongated horizontally and vertically. If I redraw it, it looks normal.
Any ideas on what is causing this and how to fix it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您初始化 UIView 时,使用 initWithFrame 并将框架设置为绘制所有内容后的正确大小等。如果您不确定这里有一些想法:
When you initialise your UIView, use initWithFrame and set the frame to the correct size that it will be after everything is drawn, etc. If you are not sure here are some ideas: