gpt4 book ai didi

iphone - ZUUIRevealController 与 UITabBarController 而不是 UINavigationController

转载 作者:行者123 更新时间:2023-11-29 13:36:33 26 4
gpt4 key购买 nike

我正在尝试将 ZUUIRevealController 实现到我的项目中,这个应用程序使用带有 3 个选项卡的 UITabBarController。

我多次浏览了截屏视频和示例代码,但我不明白为什么

[self.navigationController.parentViewController respondsToSelector:@selector(revealToggle)]

只响应 false。

在我的 appdelegate 中,我只是创建了一个简单的 UITabBarController 并将其添加为 rootViewController:

UITableViewController *activityViewController = [[[ActivityViewController alloc] initWithNibName:@"ActivityViewController" bundle:nil] autorelease];
UIViewController *agendaViewController = [[[AgendaViewController alloc] initWithNibName:@"AgendaViewController" bundle:nil] autorelease];
UIViewController *settingsViewController = [[[SettingsViewController alloc] initWithNibName:@"SettingsViewController" bundle:nil] autorelease];

UINavigationController *activityNavController = [[[UINavigationController alloc] initWithRootViewController:activityViewController] autorelease];
UINavigationController *agendaNavController = [[[UINavigationController alloc] initWithRootViewController:agendaViewController] autorelease];
UINavigationController *settingsNavController = [[[UINavigationController alloc] initWithRootViewController:settingsViewController] autorelease];

self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:activityNavController, agendaNavController, settingsNavController, nil];

SortViewController *sortViewController = [[SortViewController alloc] init];
ZUUIRevealController *revealController = [[ZUUIRevealController alloc] initWithFrontViewController:self.tabBarController rearViewController:sortViewController];
[sortViewController release];

//self.window.rootViewController = self.tabBarController;
self.window.rootViewController = revealController;

[revealController release];

[self.window makeKeyAndVisible];

但是当我在 ActivityViewController 中进行检查时,我只得到 false

if([self.tabBarController.parentViewController respondsToSelector:@selector(revealToggle)]) 
{
NSLog(@"YAY");
}
else
{
NSLog(@"WRONG");
}

在截屏视频中看起来很简单,但我好像漏掉了什么。

ZUUIRevealController:https://github.com/pkluz/ZUUIRevealController

最佳答案

在检查 respondsToSelector:: 放入 if 语句中> 喜欢

if([self.tabBarController.parentViewController respondsToSelector:@selector(revealToggle:)])

关于iphone - ZUUIRevealController 与 UITabBarController 而不是 UINavigationController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10446972/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com