I know this question has been asked many times, and I am also implementing the same foundation for chanding the name uibutton, I think.
Let me first clarify my problem. I have one uibutton named btnType, when I click on one of them to be selected, and after selecting one value, I press the "done" button to hide the collector, and at the same time I change the name of uibutton with the code
[btnType setTitle:btnTitle forState:UIControlEventTouchUpInside]; [btnType setTitleColor:[UIColor redColor] forState:UIControlEventAllEvents];
But with my surprise, it does not change, and the application crashes with the signal EXC_BAD_ACCESS. I do not get where I am making a mistake. I allocated memory for btnType in viewdidLoad. I also use
-(IBAction)pressAddType { toolBar.hidden = FALSE; dateTypePicker.hidden = FALSE; }
when you click a button to open the collector. I would also like to mention that I made contact with IB with the TouchUpInside event for pressAddType.
Any guesses? I would be grateful if you could help me. Thanks.
UPDATE:
@interface AddSettingPage : UIViewController<UITextFieldDelegate> { IBOutlet UIButton *btnType; NSString *btnTitle; } @property (nonatomic, retain) IBOutlet UIButton *btnType; -(IBAction)pressAddType;
Also
@synthesize btnType,btnTitle;
source share