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. 机器学习实战笔记(Python实现)-03-朴素贝叶斯

    --------------------------------------------------------------------------------------- 本系列文章为<机器 ...

  2. sql server 常用的扩展存储过程

    sql server 里面提供了丰富的系统存储过程来辅助我们管理数据库以及开发.今天分享介绍一些常用的数据库扩展存储过程 xp_cmdshell 这个大家都比较熟悉了,使用xp_cmdshell 可以 ...

  3. 使用Java实现单线程模式

    我们都知道单例模式,有很多种实现方法.今天我们实现一个单线程实例模式,也就是说只能实例化该类的一个线程来运行,不允许有该类的多个线程实例存在.直接上代码: public class Singleton ...

  4. 【mysql】关于binlog格式

    写在前面的话 1.推荐用mixed,默认使用statement,基于上下文  set session/global binlog_format=mixed; 2.二进制日记录了数据库执行更改的操作,如 ...

  5. JSON-RPC 2.0 规范中文文档

    链接地址如下 http://wiki.geekdream.com/Specification/json-rpc_2.0.html

  6. Warm myself by my hand

    周末的尾巴了. 前几天白日里的气温降到10摄氏度以下,穿上了秋裤.隔天跑一次步,晚上九点多,5公里,25分钟左右.换上薄薄的运动裤,两件运动衣.一出宿舍门就没觉得冷,跑着跑着就愈加热了起来.遇到的问题 ...

  7. idea 插件的使用 进阶篇

    CSDN 2016博客之星评选结果公布    [系列直播]零基础学习微信小程序!      "我的2016"主题征文活动   博客的神秘功能 idea 插件的使用 进阶篇(个人收集 ...

  8. [No00009D]使用visual studio 2015 update3打包程序安装包的简单方法(不需要InstallShield)

    注意: 该方法只适用于小型软件的打包发布: 该打包向导可以预先检查需要的运行库支持: 由于visual studio自2012后取消掉了自带的打包程序,如果有需要打包安装,需要使用一个叫用Instal ...

  9. C++类继承关系视图的自动生成

    原创文章,转载请注明出处. 工欲善其事,必先利其器.阅读大型C++工程项目,如果有一些自动化的分析工具支持,学习的效率将大大提升.在前文中介绍了Source Insight在Linux下的安装方法,本 ...

  10. [LeetCode] Non-overlapping Intervals 非重叠区间

    Given a collection of intervals, find the minimum number of intervals you need to remove to make the ...