【发布时间】:2014-06-30 18:45:59
【问题描述】:
假设我的UIViewController 有两个属性,var animal: String 和 var color: UIColor。
如何创建自定义init,以便我可以轻松地在代码中创建它?
我想拥有:
init(animal: String, color: UIColor) {
self.animal = animal
self.color = color
}
但是我得到一个编译器错误,我没有使用指定的初始化程序。我做错了什么/我应该怎么做?
【问题讨论】:
标签: ios cocoa-touch uiviewcontroller swift ios8