所以,目前,我正试图将相同的传递UINavigationBar
给多个UIViewController
s。
例如,假设我有 aUINavigationController
的视图是 aUIViewController
的UIView
。在 custom中UIViewController
,UIView
我修改了 UINavigationBar 的内容titleview
。
UIView *titleView = [[UIView alloc] initWithFrame:CGRectMake(self.navigationController.navigationBar.frame.origin.x + 50, self.navigationController.navigationBar.frame.origin.y, self.navigationController.navigationBar.frame.size.width - 100, 44)];
UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom];
button1.frame = CGRectMake(35, titleView.frame.origin.y + 2, 40, 40);
[button1 setImage:[UIImage imageNamed:@"FacebookFriendRequestIcon.png"] forState:UIControlStateNormal];
[button1 addTarget:self action:@selector(FriendRequestsPopover:) forControlEvents:UIControlEventTouchUpInside];
[titleView addSubview:button1];
UIButton *button2 = [UIButton buttonWithType:UIButtonTypeCustom];
button2.frame = CGRectMake(80, titleView.frame.origin.y + 2, 40, 40);
[button2 setImage:[UIImage imageNamed:@"FacebookMessagesIcon.png"] forState:UIControlStateNormal];
[button2 addTarget:self action:@selector(MessagesPopover:) forControlEvents:UIControlEventTouchUpInside];
[titleView addSubview:button2];
UIButton *button3 = [UIButton buttonWithType:UIButtonTypeCustom];
button3.frame = CGRectMake(125, titleView.frame.origin.y + 2, 40, 40);
[button3 setImage:[UIImage imageNamed:@"FacebookNotificationsIcon.png"] forState:UIControlStateNormal];
[button3 addTarget:self action:@selector(NotificationsPopover:) forControlEvents:UIControlEventTouchUpInside];
[titleView addSubview:button3];
self.navigationItem.titleView = titleView;
当用户按下 UIViewcontroller 中的按钮(不指导航栏的项目)时,用户会被推送到另一个UIViewController
:
GeneralInfoViewController *generalInformationController = [[GeneralInfoViewController alloc] init];
[self.navigationController pushViewController:generalInformationController animated:YES];
UIViewController1(UINavigationController) pushes to UIViewController2(UINavigationController)
因此,generalInformationController
被子类化为UIViewController
。现在,当推送发生时,我希望发生动画,但仅限于UIView
' 而不是 NavigationBar。
一个示例应用程序就像 Facebook,导航栏的中间按钮(消息、好友请求和通知)总是可见的,并且当视图控制器被压入堆栈时永远不会动画消失。
有人对如何做到这一点有任何想法吗?我想理论上的答案会很好,但编码示例会更好:)