在iOS情节提要之前,我使用笔尖并使用以下代码来呈现UIViewControllers视图。我试图弄清楚如何使用情节提要。调用initWithNib时,它崩溃了。我愿意就如何解决此问题提出所有建议。先感谢您。

       folderCollectionView = [[FolderCollectionViewController alloc] initWithNibName:@"FolderCollectionViewController" bundle:nil];

        folderView = [folderCollectionView view];
        [folderView setFrame:CGRectMake([[self view] bounds].origin.x, [[self view] bounds].origin.y, [[self view] bounds].size.width, [[self view] bounds].size.height)];
        folderCollectionView.delegate = self;
        [[self view] insertSubview:folderView atIndex:1];
        [[self view] bringSubviewToFront:folderView];
        [folderView setBackgroundColor:[UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.0f]];

        folderView.alpha = 0.0;
        [UIView animateWithDuration:1.2f
                              delay:0.0f
                            options: UIViewAnimationCurveEaseIn
                         animations:^{
                             folderView.alpha = 1.0;
                         }completion:nil];

最佳答案

更换

   folderCollectionView = [[FolderCollectionViewController alloc] initWithNibName:@"FolderCollectionViewController" bundle:nil];




   folderCollectionView = [self.storyboard instantiateViewControllerWithIdentifier:@"FolderCollectionViewController" bundle:nil];


确保在界面构建器中设置标识符

关于objective-c - 当前的UIViewControllers View Storyboard ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12650040/

10-12 07:28