XCode8 initWithCoder frame Size

风格不统一 提交于 2019-12-10 16:37:48

问题


Found if use XCode 8 XIB file, the UIView initWithCoder will get frame (0, 0, 1000, 1000) instead of the XIB frame size setting.

Check the diff of XIB xml file it will add

<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>

and remove rect frame settings such as

<rect key="frame" x="110" y="0.0" width="20" height="17"/>

Removing rect frame setting is the major root cause to get width 1000 and height 1000 in the initWithCoder.

Therefore, any related size calculation, we need to handle in layoutSubviews.

来源:https://stackoverflow.com/questions/39631583/xcode8-initwithcoder-frame-size

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!