//联系人:石虎QQ: 1224614774昵称:嗡嘛呢叭咪哄
#pragma mark -创建返回按钮
//1.初始化按钮UIButton
UIButton* leftBtn = [UIButtonbuttonWithType:UIButtonTypeSystem];
//1.2设置位置
leftBtn.frame=CGRectMake(0,0,25,25);
//1.3添加背景颜色
[leftBtnsetBackgroundImage:[UIImageimageNamed:@"icon_back"]forState:UIControlStateNormal];
//1.4监听
[leftBtnaddTarget:selfaction:@selector(leftBarBtnClicked:)forControlEvents:UIControlEventTouchUpInside];
//2初始化按钮UIBarButtonItem
UIBarButtonItem* leftBarBtn = [[UIBarButtonItemalloc]initWithCustomView:leftBtn];
//2.2创建UIBarButtonSystemItemFixedSpace
UIBarButtonItem* spaceItem = [[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpacetarget:nilaction:nil];
//2.3将宽度设为负值
spaceItem.width= -15;
//2.4将两个BarButtonItem都返回给NavigationItem
self.navigationItem.leftBarButtonItems=@[spaceItem,leftBarBtn];
谢谢!!!