import UIKit
class ViewController: UIViewController {
@IBOutlet weak var userGuessTextField: UITextField!
@IBOutlet var resultLabel: UIView!
@IBAction func Guess(sender: AnyObject) {
let diceRoll = String(arc4random_uniform(6))
if diceRoll == userGuessTextField.text
{
resultLabel.text = "You are right"
}
else
{
resultLabel.text = "You are "
}
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
誰か助けてもらえますか?なぜ私はiOSの初心者であり、この言語を学んでいるので、このエラーが発生しています。タイプの値UIviewにはメンバーテキストがありません
あなたの 'resultLabel'は' UILabel'ではなく 'UIView'です...これはUIViewにメンバ' text'がないのでうまくいきません...あなたは 'UILabel'を使う必要があります –
' resultLabel 'アウトレットは' UIView'または 'UILabel'に接続されていますか? .. '.text'の作業をするために' UILabel'に接続する必要があります。 – Laffen
さて、あなたが 'resultLabel.image = [UIImage imageNamed:@" dummy.png "];'を書くと、UIViewにはメンバイメージがないタイプの値を得ます。 ' – TheTiger