这就是我到目前为止在我的代码中所拥有的:我正在使用情节提要......
- (IBAction)OpenActionSheetButton:(id)sender {
UIActionSheet *actionsheet = [[UIActionSheet alloc]initWithTitle:@"There is no going back, are you sure???" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Continue" otherButtonTitles:nil, nil];
[actionsheet showInView:self.view];
}
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex: (NSInteger)buttonIndex
{
if(buttonIndex == 0)
{
if(buttonIndex == 0)
[self performSegueWithIdentifier:@"openView" sender:self];
UIViewController *controller = [self.storyboard
instantiateViewControllerWithIdentifier:@"storyboardViewIdentifier"];
//storyboardViewIdentifier is the ViewController identifier you specify in the storyboard
//PUSH
[self.navigationController pushViewController:controller animated:YES];
//Modal
[self presentViewController:controller animated:YES completion:Nil];
}
}
/// 我的新代码:
- (IBAction)OpenActionSheetButton:(id)sender {
UIActionSheet *actionsheet = [[UIActionSheet alloc]initWithTitle:@"There is no going back, are you sure???" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Continue" otherButtonTitles:nil, nil];
[actionsheet showInView:self.view];
}
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(buttonIndex == 0)
{
if(buttonIndex == 0)
[self performSegueWithIdentifier:@"openView" sender:self];
}
}
我没有错误,但是当我按下“继续”时,应用程序 force=closes 因为它没有正确连接。我的问题是,我的情节提要中不应该有什么?从具有操作表的视图控制器拖动到我希望“继续”按钮导航到(打开)的视图控制器?这就是我想要发生的事情。谢谢家伙,我对开发很陌生,我正在努力学习。你们帮了很多忙:)