是的,所以即时尝试为一个tic tac toe游戏制作一个2d数组,并让viewcontrller没有名为:button0的成员,为什么我在尝试创建这个数组时得到错误
@IBOutlet weak var button0: UIButton!
@IBOutlet weak var button1: UIButton!
@IBOutlet weak var button2: UIButton!
@IBOutlet weak var button3: UIButton!
@IBOutlet weak var button4: UIButton!
@IBOutlet weak var button5: UIButton!
@IBOutlet weak var button6: UIButton!
@IBOutlet weak var button7: UIButton!
@IBOutlet weak var button8: UIButton!
let buttons = [
[button0,button1,button2], //error comes from button0
[button3,button4,button5],
[button6,button7,button8]
]
答案 0 :(得分:0)
将 btnArray 转换为UIButton
,如下所示
var btnArray: [[UIButton]] = [
[button0, button1, button2],
[button3, button4, button5],
[button6, button7, button8]
]
答案 1 :(得分:0)
您无法在初始化阶段使用类成员,您应该在viewDidLoad中分配值:
<div class="vcard">
<div class="tel">
12345555555
</div>