iphone facebook 应用程序如何修复导航栏 [英] how iphone facebook app make the navigation bar fixed

查看:17
本文介绍了iphone facebook 应用程序如何修复导航栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 iPhone 开发的新手,想询问有关导航控制器的问题.如何使导航控制器固定在整个应用程序上,例如 facebook 导航栏.它始终在导航栏中显示通知、好友和消息.

I'm new in iPhone development and want to ask about the navigation controller. How can I make the navigation controller fixed over the whole application, like the facebook navigation bar. It always shows the notification, friends and messages in the navigation bar.

我正在尝试将自定义视图放在 titleView 中,但每次导航推送新视图时它都会消失?

I'm trying to put custom view in the titleView but it disappears every time the navigation push new view?

推荐答案

这对我有用:

toolBar = [[UIView alloc]initWithFrame:CGRectMake(105, 20, 105, 44)];
notificationsBtn = [UIButton buttonWithType:UIButtonTypeCustom];
messagesBtn = [UIButton buttonWithType:UIButtonTypeCustom];

[notificationsBtn setImage:[UIImage imageNamed:@"notifications-icon.png"] forState:UIControlStateNormal];
[notificationsBtn setFrame:CGRectMake(35, 0, 35 , 44)];
[notificationsBtn addTarget:self action:@selector(showNotifications:) forControlEvents:UIControlEventTouchUpInside];

[messagesBtn setImage:[UIImage imageNamed:@"messages-icon.png"] forState:UIControlStateNormal];
[messagesBtn setFrame:CGRectMake(70, 0, 35 , 44)];
[messagesBtn addTarget:self action:@selector(showMessages:) forControlEvents:UIControlEventTouchUpInside];

[toolBar addSubview:notificationsBtn];
[toolBar addSubview:messagesBtn];

[_window.rootViewController.view addSubview:toolBar];

这篇关于iphone facebook 应用程序如何修复导航栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆