【发布时间】:2012-05-15 17:21:17
【问题描述】:
我已经检查了好几次,以确保我在 IB 中的连接是正确的。
// This does not work
UIButton *additionButton = [self.gameShopCoinButtonCollection objectAtIndex:0];
additionButton.enabled = NO;
// This does work
-(IBAction)gameShopBuyButtonPressed:(UIButton *)sender {
sender.enabled = NO;
}
【问题讨论】:
-
[self.gameShopCoinButtonCollection objectAtIndex:0];return 不是nil对象吗? -
返回nil,但是显示在IB中是连接的。
-
尝试使用直接引用而不是集合。它应该可以节省您的时间。
-
直接引用了还是nil
-
属性(强,非原子) IBOutlet UIButton *gameButtonAdditionCoins;合成gameButtonAdditionCoins = _gameButtonAdditionCoins;我还有什么遗漏的吗?
标签: objective-c xcode uibutton