我想在我的iOS应用程序用户可以选择一些领域上点击UIButton
。更改UIButton的图像选择或取消选择
我当用户选择的UIButton
点击领域想,按钮的形象应该改变,并打开我的MMPickerView
,当用户再次点击UIButton
应该得到选择,而在UIButton
显示一张图像,此时不要打开MMPickerview
。
这是我的代码:
- (IBAction)showPickerViewButtonPressed:(id)sender {
if((_button.selected = !_button.selected))
{
UIImage *bimage=[UIImage imageNamed: @"play.jpg"];
[_button setImage:bimage forState:UIControlStateNormal];
}
else
{
[MMPickerView showPickerViewInView:self.view
withStrings:_stringsArray
withOptions:@{MMbackgroundColor: [UIColor blackColor],
MMtextColor: [UIColor whiteColor],
MMtoolbarColor: [UIColor blackColor],
MMbuttonColor: [UIColor whiteColor],
MMfont: [UIFont systemFontOfSize:18],
MMvalueY: @3,
MMselectedObject:_selectedString}
completion:^(NSString *selectedString) {
_label.text = selectedString;
_selectedString = selectedString;
}];
}
}
@拉梅什由于添加这个我已经申请你的代码,但它不符合我requirements.Same事情正在发生。 – Daljeet 2014-10-10 07:05:14
编辑代码,现在检查 – 2014-10-10 08:47:01