切换视图时的SIGABRT

时间:2011-11-04 13:24:30

标签: iphone objective-c

@interface Objective_C_LibraryViewController : UIViewController {
    IBOutlet UIButton *enterSecondMenu;

}

-(IBAction)enterSecondMenu:(id)sender;

@end

@implementation Objective_C_LibraryViewController

-(IBAction)enterSecondMenu:(id)sender {
    SecondMainMenu *enterSecondMenu = [[SecondMainMenu alloc]initWithNibName:Nil bundle:Nil];
    [self presentModalViewController: enterSecondMenu animated:YES];
}

当我按下已连接接收插座的UIButton时,它会收到一个SIGABRT。

1 个答案:

答案 0 :(得分:0)

您的enterSecondMenu中的本地变量名称与您的IBOutlet属性相同。将 - (IBAction)enterSecondMenu:(id)发件人中的代码更改为以下内容:

SecondMainMenu *secondMenu = [[SecondMainMenu alloc]initWithNibName:Nil bundle:Nil];    
[self presentModalViewController: secondMenu animated:YES];