美团HD(2)-设置导航栏内容
DJHomeViewController.m
#import "DJHomeViewController.h"
#import "DJConstantValue.h"
#import "DJNavTopItem.h" @implementation DJHomeViewController - (instancetype)init { UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
return [self initWithCollectionViewLayout:layout];
} - (void)viewDidLoad { [super viewDidLoad];
self.collectionView.backgroundColor = DJColor(, , ); [self setupRightNavItem];
[self setupLeftNavItem]; } /** 设置导航栏右侧内容 */
- (void)setupRightNavItem { // 地图
UIBarButtonItem *mapItem = [UIBarButtonItem itemWithTarget:self action:nil image:@"icon_map" highlighImage:@"icon_map_highlighted"];
mapItem.customView.width = ;
// mapItem.customView.backgroundColor = [UIColor redColor]; // 搜索
UIBarButtonItem *searchItem = [UIBarButtonItem itemWithTarget:self action:nil image:@"icon_search" highlighImage:@"icon_search_highlighted"];
searchItem.customView.width = ;
// searchItem.customView.backgroundColor = [UIColor greenColor]; self.navigationItem.rightBarButtonItems = @[mapItem,searchItem]; } /** 设置导航栏左侧内容 */
- (void)setupLeftNavItem { UIImageView *logoView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_meituan_logo"]];
UIBarButtonItem *logoItem = [[UIBarButtonItem alloc] initWithCustomView:logoView]; DJNavTopItem *item01 = [DJNavTopItem item];
UIBarButtonItem *item1 = [[UIBarButtonItem alloc] initWithCustomView:item01]; DJNavTopItem *item02 = [DJNavTopItem item];
UIBarButtonItem *item2 = [[UIBarButtonItem alloc] initWithCustomView:item02]; DJNavTopItem *item03 = [DJNavTopItem item];
UIBarButtonItem *item3 = [[UIBarButtonItem alloc] initWithCustomView:item03]; self.navigationItem.leftBarButtonItems = @[logoItem,item1,item2,item3]; } @end
最终效果:

美团HD(2)-设置导航栏内容的更多相关文章
- 美团HD(1)-设置导航栏主题
自定义一个UINavigationController DJNavigationController.h #import <UIKit/UIKit.h> @interface DJNavi ...
- 设置导航栏nav全透明
设置导航栏nav全透明 p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #ffffff } span.s1 { } ...
- IOS 设置导航栏
//设置导航栏的标题 self.navigationItem setTitle:@"我的标题"; //设置导航条标题属性:字体大小/字体颜色…… /*设置头的属性:setTitle ...
- IOS 设置导航栏全局样式
// 1.设置导航栏背景 UINavigationBar *bar = [UINavigationBar appearance]; [bar setBackgroundImage:[UIImage r ...
- iOS不得姐项目--appearance的妙用,再一次设置导航栏返回按钮,导航栏左右按钮的封装(巧用分类)
一.UI_APPEARANCE_SELECTOR 彩票项目中appearance的用法一直没有搞明白,这次通过第二个项目中老师的讲解,更深一层次的了解到了很多关于appearance的作用以及使用方法 ...
- iOS 设置导航栏之二(设置导航栏的颜色、文字的颜色、左边按钮的文字及颜色)
#import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicati ...
- iOS 设置导航栏的颜色和导航栏上文字的颜色
#import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @pr ...
- wordpress设置导航栏
设置导航栏,首先你要设置你的导航分类.登陆后台---文章---分类目录,首先在这里输入你要写入导航的标题. 设置好后点击---外观---菜单这个地方就可以具体的设置导航的排序和下拉等二级
- iOS设置导航栏样式(UINavigationController)
//设置导航栏baritem和返回baiitem样式 UIBarButtonItem *barItem = [UIBarButtonItem appearance]; //去掉返回按钮上的字 [bar ...
随机推荐
- 机器学习实战笔记(Python实现)-05-支持向量机(SVM)
--------------------------------------------------------------------------------------- 本系列文章为<机器 ...
- 使用jekins自动构建部署java maven项目(jdk1.7+tomcat7.0+jenkins2.19.3)
1.下载jenkins 地址:https://jenkins.io/index.html 本人下载了2.19.3版本的war包:jenkins.war 2.安装jenkins 拷贝jenkins.wa ...
- [LeetCode] Find the Celebrity 寻找名人
Suppose you are at a party with n people (labeled from 0 to n - 1) and among them, there may exist o ...
- [LeetCode] Remove Duplicates from Sorted Array 有序数组中去除重复项
Given a sorted array, remove the duplicates in place such that each element appear only once and ret ...
- Docker命令学习
今天更换腾讯云系统的时候发现了多了个CoreOS,据说是专门运行docker的轻量系统,顺便学习一下docker命令. 1. docker version 显示 Docker 版本信息. 2. doc ...
- JQuery选择器
动态修改样式 $("#div1").attr("display","block"); //有问题 $("#div1"). ...
- 使用haproxy的ACL封禁IP
http://www.360doc.com/content/11/1226/13/834950_175075893.shtml 该方法,用户访问得到的是403页面 或者尝试用http-request拒 ...
- table表框去掉相邻的间隔
HTML <table> <tr> <th>名称</th> <th>描述</th> </tr> <tr> ...
- Python进制转换
一 内置函数 bin().oct().hex()的返回值均为字符串,且分别带有0b.0o.0x前缀. 实例 统计二进制数里1的个数 def countBits(n): return bin(n).co ...
- Beennan的内嵌汇编指导(译)Brennan's Guide to Inline Assembly
注:写在前面,这是一篇翻译文章,本人的英文水平很有限,但内嵌汇编是学习操作系统不可少的知识,本人也常去查看这方面的内容,本文是在做mit的jos实验中的一篇关于内嵌汇编的介绍.关于常用的内嵌汇编(AT ...