本文介绍了调用超类的awakeFromNib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我安装了Xcode 8.0 beta(8S128d)。现在我有一些警告消息:
I installed Xcode 8.0 beta (8S128d). Now I have some warnings with message:
Method possibly missing a [super awakeFromNib] call
。
在哪种情况下我需要调用这个超类的方法?
in all awakeFromNib
methods.In which case I need to call this method of superclass?
推荐答案
根据:
在Xcode 8之前,没有严格的编译器要求,无论Apple如何用Xcode8改变它,如果调用 [super awakeFromNib]
(或 swift中的super.awakeFromNib()。
Before Xcode 8, there was no strict compiler requirement for this , howeever Apple has changed this with Xcode8, and compiler treats it as error if call to [super awakeFromNib]
(or super.awakeFromNib()
in swift) is missing in awakeFromNib.
所以Swift版本看起来像这样:
So Swift version would look something like this:
func awakeFromNib() {
super.awakeFromNib()
... your magical code ...
}
这篇关于调用超类的awakeFromNib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!