关于从 UIView 派生的自定义类的边界/框架的问题
我有一个从 UIView 派生的类,它表示将在其上绘制对象的方形区域(280x280),但不知何故只绘制了上部部分(280x187)。
我检查了自定义视图类的initWithCoder和drawRect中的边界和框架,结果是:
initWithCoder-->bounds:(280x280);框架:(280x280)
绘制矩形----->边界:(280x187); frame:(280x187)
initWithCoder 和 drawRect 方法之间可能会发生什么改变了边界和框架?
感谢您提供信息。
I have a class derived from UIView, it represents a square area(280x280) over which objects will be drawn, but somehow only the upper portion(280x187) was drawn.
I checked the bounds and frame within the initWithCoder and drawRect of the custom view class, the results are:
initWithCoder-->bounds:(280x280); frame:(280x280)
drawRect------->bounds:(280x187); frame:(280x187)
What could possible happen between initWithCoder and drawRect methods that changed both the bounds and frame?
Thanks for the information.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在InterfaceBuilder中,我关闭了视图的自动调整大小并取出了弹簧和支柱,然后视图正确显示了。
Inside InterfaceBuilder, I turned off the autoresize of view and took out the springs and struts, then the view displayed properly.