如何使actionsheet转到另一个视图?Xcode,小问题,,,

如何使actionsheet转到另一个视图?Xcode,小问题,,,,xcode,uistoryboard,next,Xcode,Uistoryboard,Next,我试图为另一个按钮制作一个操作表,但我得到两个错误:“UIstoryboard”没有可见的@interface声明选择器“InitiateViewControl:”,并且,没有可见的@interface for SWViewController“声明选择器”presentViewController:animated:“我正在给这段代码命名,所以我需要在这段代码中命名任何名称,以使这段代码对我的代码进行成本分解吗?”?我正在努力学习我是一个noob对不起:这是我到目前为止的代码: - (IBAc

我试图为另一个按钮制作一个操作表,但我得到两个错误:“UIstoryboard”没有可见的@interface声明选择器“InitiateViewControl:”,并且,没有可见的@interface for SWViewController“声明选择器”presentViewController:animated:“我正在给这段代码命名,所以我需要在这段代码中命名任何名称,以使这段代码对我的代码进行成本分解吗?”?我正在努力学习我是一个noob对不起:这是我到目前为止的代码:

- (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) {

        UIViewController *controller = [self.storyboard instantiateViewControll:@"storyboardViewName"];
        //Push
        [self.navigationController pushViewController:controller animated:YES];
        //Modal
        [self presentViewController:controller animated:YES];

    }

}

请帮帮忙?

试试这个代码..而且SWViewController必须有一个导航控制器


试试这个。这对我很有用:

 if(buttonIndex == 0) 
 {
 NSString * storyboardName = @"Main";
 UIStoryboard *storyboard = [UIStoryboard storyboardWithName:storyboardName bundle: nil];
 Paypal_ViewController * vc = [storyboard instantiateViewControllerWithIdentifier:@"Paypal_ViewController"];
 [self presentViewController:vc animated:YES completion:nil];
 }

我不熟悉故事板。我仍然认为你不能在你的xib中使用UIActionsheet。所以你不能用它来写IBOutlet,也不能用它的方法来写IBAction。对不起,我不太理解你的评论。谢谢你的回答:老兄!!!!!非常感谢!!!你说的导航控制器是什么意思?我该怎么做?包含actionsheet的页面是否应该是从库中拖入的NavigationController的一部分???再次感谢!我在慢慢地学习!英雄联盟如果你想在项目中导航,你需要添加一个UINavigationController并将初始ViewController设置为它的rootcontroller…好的,那么你是说当你从库中将UINavigationController拖动到你的工作空间中时,我需要做的是使包含操作表的视图成为这两个视图的第一页,对吗?如果我对你有困难,我很抱歉,但是你能为我说得简单一点吗?谢谢,要从一个ViewController转到另一个,您的项目中需要UINavigationController。将UINavigationController拖放到情节提要,并将初始ViewController设置为UINavigationController的根控制器。现在您可以在代码中调用self.navigationController和self-presentViewController了……好的,我现在就给您打电话。但是,我是像中那样将其拖到情节提要中,使其显示另外两个视图,还是将其拖到其中一个视图中?如果是这样的话,我应该把它放在有操作表的视图中,还是放在我想用操作表按钮转到的视图中?
 if(buttonIndex == 0) 
 {
 NSString * storyboardName = @"Main";
 UIStoryboard *storyboard = [UIStoryboard storyboardWithName:storyboardName bundle: nil];
 Paypal_ViewController * vc = [storyboard instantiateViewControllerWithIdentifier:@"Paypal_ViewController"];
 [self presentViewController:vc animated:YES completion:nil];
 }