Group HD (2)-Set navigation bar content

Source: Internet
Author: User

Djhomeviewcontroller.m

#import "DJHomeViewController.h"#import "DJConstantValue.h"#import "DJNavTopItem.h"@implementationDjhomeviewcontroller-(instancetype) init {uicollectionviewflowlayout*layout =[[Uicollectionviewflowlayout alloc] init]; return[self initwithcollectionviewlayout:layout];}- (void) viewdidload {[Super viewdidload]; Self.collectionView.backgroundColor= Djcolor ( the, the, the);    [Self setuprightnavitem]; [Self Setupleftnavitem];}/** Set the right content of the navigation bar*/- (void) Setuprightnavitem {//MapUibarbuttonitem *mapitem = [Uibarbuttonitem itemwithtarget:self action:nil Image:@"Icon_map"Highlighimage:@"icon_map_highlighted"]; MapItem.customView.width= -;//MapItem.customView.backgroundColor = [Uicolor Redcolor]; //SearchUibarbuttonitem *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];}/** Set the left content of the navigation bar*/- (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

Final effect:

Group HD (2)-Set navigation bar content

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.