我想在我的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