每个人。我正在开发 iphone 应用程序。
我尝试在我的代码中更改按钮的标题。当我单击一个按钮时,标题将更改其他文本。
所以,我使用 setTitle 方法,但应用程序被杀死了。
代码如下。
-(IBAction)deleteProject:(id)sender{
UIButton *button = (UIButton *) sender;
if (addButton.enabled == YES ){
addButton.enabled = NO ;
//Here, the code is stopped.
[button setTitle:@"Back" forstate:UIControlStateNormal];
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[mainTableView setEditing:YES animated:YES];
}
else{
addButton.enabled = YES;
//Here, the code is stopped. V
[button setTitle:@"Delete" forstate:UIControlStateNormal];
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[mainTableView setEditing:NO animated:YES];
}
}
请帮我。