我正在使用开源来处理 Facebook 风格的滑动菜单。我在下面遇到异常。
UITabBarController setTopViewController:]: unrecognized selector sent to instance
我正在使用 ARC、Storyboard、XCode 4.5 和UITabController
. 它试图做的是设置一个 viewController。Vc 不为空。
它正在尝试将视图控制器设置为下方并引发错误。ExploreViewController 嵌入在 Navigation Controller 中,而且UITabBarController
.
@property (nonatomic, strong) UIViewController *topViewController;
这是我的代码。
ECSlidingViewController *slidingViewController = (ECSlidingViewController *)self.window.rootViewController;
UIStoryboard *storyboard;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
} else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
storyboard = [UIStoryboard storyboardWithName:@"iPad" bundle:nil];
}
UIViewController *vc= [storyboard instantiateViewControllerWithIdentifier:@"ExploreViewController"];
slidingViewController.topViewController = vc; //exception thrown here.