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)-设置导航栏内容的更多相关文章

  1. 美团HD(1)-设置导航栏主题

    自定义一个UINavigationController DJNavigationController.h #import <UIKit/UIKit.h> @interface DJNavi ...

  2. 设置导航栏nav全透明

    设置导航栏nav全透明 p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #ffffff } span.s1 { } ...

  3. IOS 设置导航栏

    //设置导航栏的标题 self.navigationItem setTitle:@"我的标题"; //设置导航条标题属性:字体大小/字体颜色…… /*设置头的属性:setTitle ...

  4. IOS 设置导航栏全局样式

    // 1.设置导航栏背景 UINavigationBar *bar = [UINavigationBar appearance]; [bar setBackgroundImage:[UIImage r ...

  5. iOS不得姐项目--appearance的妙用,再一次设置导航栏返回按钮,导航栏左右按钮的封装(巧用分类)

    一.UI_APPEARANCE_SELECTOR 彩票项目中appearance的用法一直没有搞明白,这次通过第二个项目中老师的讲解,更深一层次的了解到了很多关于appearance的作用以及使用方法 ...

  6. iOS 设置导航栏之二(设置导航栏的颜色、文字的颜色、左边按钮的文字及颜色)

                      #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicati ...

  7. iOS 设置导航栏的颜色和导航栏上文字的颜色

    #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @pr ...

  8. wordpress设置导航栏

    设置导航栏,首先你要设置你的导航分类.登陆后台---文章---分类目录,首先在这里输入你要写入导航的标题. 设置好后点击---外观---菜单这个地方就可以具体的设置导航的排序和下拉等二级

  9. iOS设置导航栏样式(UINavigationController)

    //设置导航栏baritem和返回baiitem样式 UIBarButtonItem *barItem = [UIBarButtonItem appearance]; //去掉返回按钮上的字 [bar ...

随机推荐

  1. 随机生成长度为len的密码,且包括大写、小写英文字母和数字

    一道华三面试题,随机生成长度为len的密码,且包括大写.小写英文字母和数字,主要Random类的使用,random.nextInt(len)表示生成[0,len)整数.具体实现见下面代码,已经很详细了 ...

  2. linux基本知识

    1.默认不写端口号就是80端口   127.0.0.1.localhost都代表本机 2.linux下的用户管理: id:可以查看当前用户whoami:查看当前的用户who:看当前已经登录的用户w:也 ...

  3. Java类加载基本过程

    基本过程:   根据类的全限定名称加载定义类的二进制字节流. 将字节流代表的静态存储结构转化为方法区的运行时数据结构 内存中生成一个代表这个类的java.lang.Class对象,作为方法去这个类的各 ...

  4. Java 中一个过时的类,能够很好的统计单个字符串的次数

    //StringTokenizer st1=new StringTokenizer("rirtirtjdlkfjlksadfoiyetryetretrejtlkjdsflkiuetuiojr ...

  5. Memcached初探

    一.Memcached是什么 Memcached是由Danga Interactive开发的,高性能的,分布式的内存对象缓存系统,用于在动态应用中减少数据库负载,提升访问速度. Memcached基于 ...

  6. ASP.NET Cookie(一)--基本应用

    Cookie提供了一种在Web应用程序中存储用户特定信息的方法.例如,当用户访问您的站点时,您可以使用Cookie存储用户首选项或其他信息.当该用户再次访问您的网站时,应用程序便可以检索以前存储的信息 ...

  7. Kubernets搭建Kubernetes-dashboard

    接上篇文章,在已经部署好Kubernetes的基础上部署kubernetes-dashboard,它是官方提供的用户管理Kubernets集群可视化工具:部署dashboard其实和在kubernet ...

  8. java工具类

    1.HttpUtilsHttp网络工具类,主要包括httpGet.httpPost以及http参数相关方法,以httpGet为例:static HttpResponse httpGet(HttpReq ...

  9. mybatis常见易出错

    在学习mybatis的过程中,发现了很多错误,这里记录一下,以供后来使用 1,config.xml文件中配置项的顺序: org.apache.ibatis.exceptions.Persistence ...

  10. 【转】BAT 批处理脚本 教程

    第一章 批处理基础第一节 常用批处理内部命令简介批处理定义:顾名思义,批处理文件是将一系列命令按一定的顺序集合为一个可执行的文本文件,其扩展名为BAT或者CMD.这些命令统称批处理命令.小知识:可以在 ...