2016-08-01 3 views
-4

Int의 변수를 UILabel에 할당 할 수 없습니다. 어떻게 해결할 수 있습니까?Int의 변수를 UILabel에 할당 할 수 없습니다.

수입 UIKit

클래스의 ViewController :의 UIViewController {

@IBOutlet var CoinCounterInt: UILabel! 
@IBOutlet weak var CoinCounter: UILabel! 
var coins = 0 
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. 
} 


@IBAction func Clicker(sender: AnyObject) { 
    coins += 1 
    CoinCounterInt = "\(coins)" 
} 

}

당신은 레이블의 텍스트 속성에 문자열을 할당해야

답변

1

:
CoinCounterInt.text = "\(coins)"

+1

@NilsGarland 네가별로 보지 않았기 때문에 나는 추측한다. –

관련 문제