首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >带有故事板的ViewDeck

带有故事板的ViewDeck
EN

Stack Overflow用户
提问于 2012-12-30 06:27:25
回答 3查看 4.7K关注 0票数 2

我的应用程序使用ViewDeck时遇到了一些问题。

我正在尝试将其与storyboard一起使用,而示例仅展示了如何将其与nibfile一起使用。我已经在stackexchange上检查了很多方法,但我似乎不能让它工作。

我的appdelegate.m文件中的代码:

代码语言:javascript
复制
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

    //UIViewController* leftController = [[UIViewController alloc] init];

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];

    RightViewController* rightController = [[RightViewController alloc] initWithNibName:@"RightViewController" bundle:nil];

    ViewController* centerController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
    self.centerController = [[UINavigationController alloc] initWithRootViewController:centerController];
    IIViewDeckController* deckController = [[IIViewDeckController alloc] initWithCenterViewController:self.centerController rightViewController:rightController];

    deckController.rightSize = 100;

    self.window.rootViewController = deckController;
    [self.window makeKeyAndVisible];
    return YES;

}

我当然会得到预期的错误:

代码语言:javascript
复制
2012-12-29 03:55:18.501 Network[27451:c07] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/Rostgaard/Library/Application Support/iPhone Simulator/6.0/Applications/C2BADD3B-660E-4363-8FC7-932B4E9D6172/Network.app> (loaded)' with name 'RightViewController''
*** First throw call stack:
(0x17cd012 0x15f2e7e 0x17ccdeb 0x755fac 0x61ae37 0x61b418 0x61b648 0x61b882 0xbcdf 0xe673 0xb7e2 0xada7 0x61d753 0x61da7b 0x61e964 0x581877 0x5885a3 0x580eed 0x56ab56 0x56adbf 0x56af55 0x573f67 0x2546 0x5377b7 0x537da7 0x538fab 0x54a315 0x54b24b 0x53ccf8 0x261adf9 0x261aad0 0x1742bf5 0x1742962 0x1773bb6 0x1772f44 0x1772e1b 0x5387da 0x53a65c 0x226d 0x2195 0x1)
libc++abi.dylib: terminate called throwing an exception
(lldb) 
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2013-01-05 08:23:39

好吧,我自己用ECSlidingViewController解决了这个问题,它已经用storyboard优化过了。

https://github.com/edgecase/ECSlidingViewController

以防有人遇到同样的问题。

票数 5
EN

Stack Overflow用户

发布于 2013-05-10 22:20:16

下面是我使用的代码,它工作得很好:

代码语言:javascript
复制
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

    UIStoryboard* mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle: nil];
    UIViewController* menuController = [mainStoryboard instantiateViewControllerWithIdentifier:@"LeftSideMenu"];

    UINavigationController* navigationController = (UINavigationController *) self.window.rootViewController;
    self.viewDeckController =  [[IIViewDeckController alloc] initWithCenterViewController:navigationController leftViewController:menuController rightViewController:nil];
    self.window.rootViewController = self.viewDeckController;
}
票数 9
EN

Stack Overflow用户

发布于 2013-01-14 02:38:10

试试这个tutorial project,它很管用。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14086459

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档