我知道這個問題必須回答之前,但我仍然想知道爲什麼第一行代碼不能改變UIButton
的標題,而第二行可以。除了第一行是從一個BigNerdRanch的Objective-C書中複製的......我將其作爲示例運行。通過titleLabel.text屬性更改UIButton的標題不起作用:爲什麼?
[email protected]"foo"; //doesn't work
[self.assetTypeButton setTitle:@"foo" forState:UIControlStateNormal]; //this works and button title is changed.
[閱讀全文](http://stackoverflow.com/a/11417134/1066828)&[this](http://stackoverflow.com/a/4910521/1066828) –
可能的[iOS: UIButton titleLabel - 它什麼都做?](http://stackoverflow.com/questions/4910446/ios-uibutton-titlelabel-does-it-do-anything-at-all) –