【问题标题】:From view controller to PageViewController从视图控制器到 PageViewController
【发布时间】:2015-05-19 13:16:54
【问题描述】:

我有一个UIViewControllers 和两个UIButtons,我想知道如何从这个UIViewController 传递给我的UIPageViewController, 我试图将故事板中的UIButton 链接到我的UIPageViewController,但它给了我这个错误

由于未捕获的异常而终止应用程序 'NSInvalidArgumentException',原因:'Storyboard () 不包含带有标识符的视图控制器 '指南''

我该怎么办?

编辑

- (IBAction)goToGuide:(id)sender{
    [self performSegueWithIdentifier:@"goToGuide" sender:self];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([[segue identifier] isEqualToString:@"nextView"])
    {
        FirstLaunch *fLaunch = [segue destinationViewController];
        //pass any data to next view here

    }
}

将此添加到我的UIViewController 并在我的情节提要中添加标识符,在视图控制器和UIPageViewController 之间建立连接,并将标识符设置为 goToGuide,但同样的错误..

向上

EDIT2

- (IBAction)goToGuide:(id)sender{

    [(UINavigationController*)self.window.rootViewController pushViewController:Guide animated:YES];
    [self performSegueWithIdentifier:@"NextView" sender:self];
}

它说,在 FirstLaunch 类型的对象上找不到属性窗口

【问题讨论】:

    标签: ios model-view-controller uiviewcontroller storyboard uipageviewcontroller


    【解决方案1】:

    给出故事板中的segue标识符,你一定错过了。

    检查这个答案 ios automatically segue from one screen to another

    【讨论】:

    • @Jack_usti 你在 StoryBoard 中给 segue 的标识符是什么,检查故事板中的 IB。 developer.apple.com/library/mac/recipes/…
    • @Jack_usti 替换行 [self performSegueWithIdentifier:@"goToGuide" sender:self]; with [self performSegueWithIdentifier:@"nextView" sender:self];
    • 现在确定这个错误:'找不到用于 segue 'NextView' 的导航控制器。只有当源控制器由 UINavigationController 的实例管理时,才能使用推送 segue。 @UtsavParkih
    • @Jack_usti 这是因为您还没有初始化导航控制器。您需要将您的主屏幕设置为导航控制器的rootViewController,然后您才能执行此操作。
    • 我应该怎么做? @UtsavParkih
    猜你喜欢
    • 2012-02-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多