0
当前我正在使用简单的iPhone应用程序,使用Xcode 4.3.2创建它(当不使用Storyboard),当我将一个屏幕导航到另一个屏幕时,发现错误Thread1:EXC_BAD_ACCESS(code = 1.address = 0x7669739)我使用故事板来导航一个屏幕到另一个,它的工作正常。如何解决这个问题,请大家帮我在Xcode 4.3.2中将一个屏幕导航到另一个屏幕的问题?
由于提前
我想这(对于使用故事板出)
- (void)viewDidLoad
{
[super viewDidLoad];
[email protected]"Screen 1";
UIButton *btn =[UIButton buttonWithType:UIButtonTypeRoundedRect];
btn.frame=CGRectMake(10, 10, 200, 40);
[btn setTitle:@"Test" forState:UIControlStateNormal];
[btn addTarget:self action:@selector(GoToMethod) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];
// Do any additional setup after loading the view from its nib.
}
-(void)GoToMethod
{
sample2 *s2 =[[sample2 alloc]init];
[self.navigationController pushViewController:s2 animated:YES];
}
感谢您的回复,现在我尝试了这个,但是错误出现在***由于未捕获的异常'NSInvalidArgumentException',原因:' - [__ NSCFString GoToMethod]:无法识别的选择器发送到实例0x6c82a20' ** *第一次投掷堆栈: – SampathKumar
请帮助我。 – SampathKumar
我希望示例是一个带有xib的视图控制器。 – Swati