1

我正在尝试actionsheet为另一个按钮创建一个,但出现两个错误:"No visible @interface for 'UIstoryboard' declares the selector 'InitiateViewControll:'并且,"No visible @interface for SWViewController' declares the selector 'presentViewController:animated:'我正在提供此代码,所以我需要在其中命名任何名称以使此代码适合我的代码吗?我正在努力学习我是一个菜鸟对不起:(这是我到目前为止的代码:

- (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];

    }

}

请大家帮忙?

4

2 回答 2

0

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

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
    {
        if(buttonIndex == 0)
        {
            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];
        }
    }
于 2013-02-22T06:23:34.993 回答
0

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

 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];
 }
于 2015-08-26T07:44:01.227 回答