コードにバグがあり、見つからないようです。プログラムでaddButtonというボタンを作成し、そのセレクターをaddに設定しましたが、ボタンを押すたびにアプリがシミュレーターでクラッシュします。これが私のコードです。
-(void)viewDidLoad{
UIBarButtonItem *addButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self
action:@selector(add:)];
self.navigationItem.rightBarButtonItem = addButton;
[addButton release];
}
追加ボタンのコードは次のとおりです。
- (IBAction)add
{
MyDetailViewController * detail = [[MyDetailViewController alloc]init];
detail.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:detail animated:YES];
//[detail.text becomeFirstResponder];
[detail release];
}
助けてくれてありがとう:D