How to write init method for custom UIView class with xib file

寵の児 提交于 2019-12-06 01:20:09

When loading a view from an XIB initWithFrame: won't be called. Instead the method signature should be - (id)initWithCoder:(NSCoder *)decoder.

In this case you shouldn't be loading the NIB in your unit method. Some other class should be loading the view from the NIB (like a controller class).

What you have currently results in a view with no label set which has a subview with a label (with some text).

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