ZUUIRevealController - 通过按后控制器中的表格视图单元格将视图推送到前视图上
我正在使用很棒的库 ZUUIRevealController。但是,我无法对其进行编程,以便用户能够点击后控制器中的单元格。然后后控制器应该消失并在前视图中显示一个新的视图控制器。
我已经这样设置了我的项目:
VGViewController *frontViewController;
RevealController *rearViewController;
frontViewController = [[VGViewController alloc] initWithNibName:@"VGViewController" bundle:nil];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:frontViewController];
rearViewController = [[RevealController alloc] initWithNibName:@"RevealController" bundle:nil];
ZUUIRevealController *revealController = [[ZUUIRevealController alloc] initWithFrontViewController:self.navigationController rearViewController:rearViewController];
[frontViewController release];
[rearViewController release];
self.window.rootViewController = revealController;
[revealController release];
[self.window makeKeyAndVisible];
return YES;
我希望有人可以帮助我! :D
i'm playing around with the great library ZUUIRevealController. However, I can't program it so the user are able to tap a cell in the rearcontroller. The rearcontroller should then go away and display a new viewcontroller in the front view.
I've setup my project like this:
VGViewController *frontViewController;
RevealController *rearViewController;
frontViewController = [[VGViewController alloc] initWithNibName:@"VGViewController" bundle:nil];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:frontViewController];
rearViewController = [[RevealController alloc] initWithNibName:@"RevealController" bundle:nil];
ZUUIRevealController *revealController = [[ZUUIRevealController alloc] initWithFrontViewController:self.navigationController rearViewController:rearViewController];
[frontViewController release];
[rearViewController release];
self.window.rootViewController = revealController;
[revealController release];
[self.window makeKeyAndVisible];
return YES;
I hope someone can help me! :D
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
很高兴您在图书馆找到了自己喜欢的东西。
如果我没有遗漏任何东西,你的项目似乎设置正确,尽管从逻辑上讲我无法遵循后视图控制器<=>的方式。 RevealController 但我想没关系。
回答你的问题:
为了通过点击rearViewController中的单元格来显示不同的frontViewController,您需要在适当的方法中触发这段代码(例如:tableView:didSelelctRowAtIndexPath:)
这段代码的作用是,它获取对afterViewControllers 父级(应该是 RevealController),并通过调用
[revealController setFrontViewController:navigationController 为其分配一个新的 frontViewController 实例动画:NO];
希望这能解决您的问题:-)
glad you found a liking in the library.
Your project seems to be setup correctly if I'm not missing anything, although logically I'm not able to follow how the rearViewController <=> RevealController but that's okay I guess.
To answer your question:
In order to display a different frontViewController by, say tapping on a cell in the rearViewController you need to trigger this piece of code in the appropriate method (say: tableView:didSelelctRowAtIndexPath:)
What this piece of code does is, it grabs a reference to the rearViewControllers parent (which should be the revealController), and assigns a new frontViewController instance to it by calling
[revealController setFrontViewController:navigationController animated:NO];
Hope this solves your problem :-)