みんな。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];
}
}
私を助けてください。