ios – 错误:实例成员不能用于’ViewController’类型[复制]

ios – 错误:实例成员不能用于’ViewController’类型[复制],第1张

概述参见英文答案 > Instance member cannot be used on type of custom class                                    3个 我正在通过stanford课程在线讲座来制作专注游戏,我的代码的一部分出现错误.我收到错误“实例成员’cardButtons’不能用于类型’ViewController’”,但代码似乎适用于教师. 参见英文答案 > Instance member cannot be used on type of custom class                                    3个
我正在通过stanford课程在线讲座来制作专注游戏,我的代码的一部分出现错误.我收到错误“实例成员’cardbuttons’不能用于类型’VIEwController’”,但代码似乎适用于教师.有人可以帮我解决这个问题吗?这是代码的一部分.第4行出错

import UIKitclass VIEwController: UIVIEwController {@IBOutlet var cardbuttons: [UIbutton]!lazy var game = Concentration(numberOfPairsOfCards: cardbuttons.count / 2)var flipCount = 0 {    dIDSet {        flipCountLabel.text = "Flips: \(flipCount)"    }}@IBOutlet weak var flipCountLabel: UILabel!@IBAction func touchCard(sender: UIbutton) {    flipCount += 1    if let cardNumber = cardbuttons.indexOf(sender) {        game.chooseCard(at: cardNumber)        updateVIEwFromModel()    } else {        print("chosen card was not in array cardbuttons")    }}func updateVIEwFromModel() {    for index in cardbuttons.indices {        let button = cardbuttons[index]        let card = game.cards[index]        if card.isFaceUp {            button.setTitle(emoji,forState: UIControlState.normal)            button.backgroundcolor = UIcolor.whitecolor()        } else {            button.setTitle("",forState: UIControlState.normal)            button.backgroundcolor = card.isMatched ? UIcolor.clearcolor() : UIcolor.orangecolor()        }    }}    var emojiChoices = ["          总结       

以上是内存溢出为你收集整理的ios – 错误:实例成员不能用于’ViewController’类型[复制]全部内容,希望文章能够帮你解决ios – 错误:实例成员不能用于’ViewController’类型[复制]所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/998969.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存