发件人按钮会发生变化,但是当我点击桌面视图中的另一个按钮时,按钮第一个按钮图像不会改变播放
@IBAction func playSound(sender: UIButton) {
if self.player != nil && self.player.playing {
player.stop()
sender.setImage(UIImage(named: "play.png"), forState: UIControlState.Normal)
}
else {
sender.setImage(UIImage(named: "pause.png"), forState: UIControlState.Normal)
}
}
答案 0 :(得分:2)
listeners:{
afterrender:function(combo){
var me = this,
values = me.getValueRecords();
me.inputEl.set( {
'placeholder': values.length ? '' :'Hello'});
me.inputEl.set({'style':'background:red;text-decoration:underline;'});
},
change:function(tag){
window.r = this;
console.log(this);
var me = this,
values = me.getValueRecords();
me.inputEl.set( {
'placeholder': values.length ? '' :'Hello'});
}
}
答案 1 :(得分:1)
尝试为按钮设置背景图像
let image = UIImage(named: "play.png") as UIImage
sender.setBackgroundImage(image, forState: UIControlState.Normal)
希望这有帮助。
答案 2 :(得分:1)
是那个电话单选按钮。我从不在单元格中使用单选按钮。这对我来说很难。我是新手如果你需要它,那就是:Radio button logic in UItableViewCells。 但我用其他方式:didSelectRowAtIndexPath。单击单元格时,按钮当前显示暂停图像,其他按钮显示播放图像。你可以参考它
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
currentIndexPath = indexPath;
YourTableViewCell *cell = nil;
if (!previousIndexPath) {
previousIndexPath = currentIndexPath;
}
if (previousIndexPath != currentIndexPath) {
cell = (YourTableViewCell *) [_yourTableView cellForRowAtIndexPath:previousIndexPath];
[cell.radioBtn setBackgroundImage:[UIImage imageNamed:@"play"] forState:UIControlStateNormal];
cell = (YourTableViewCell *) [_yourTableView cellForRowAtIndexPath:currentIndexPath];
[cell.radioBtn setBackgroundImage:[UIImage imageNamed:@"pause"] forState:UIControlStateNormal];
previousIndexPath = currentIndexPath;
}
if (previousIndexPath == currentIndexPath) {
cell = (YourTableViewCell *) [_yourTableView cellForRowAtIndexPath:previousIndexPath];
[cell.radioBtn setBackgroundImage:[UIImage imageNamed:@"pause"] forState:UIControlStateNormal];
}
}