UIButton

UIButton *btnTrans = [UIButton buttonWithType:UIButtonTypeCustom];

[btnTrans setBackgroundImage:[UIImage imageNamed:@"btnAround.png"] forState:UIControlStateNormal];

[btnTrans setTitle:@"周边" forState:UIControlStateNormal];

[btnTrans setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];

btnTrans.titleLabel.font = [UIFont systemFontOfSize:12];

btnTrans.frame = CGRectMake(0.0, 0.0, 50, 31);

[btnTrans addTarget:self action:@selector(backBtnAction:) forControlEvents:UIControlEventTouchUpInside];

tempButton = [[UIBarButtonItem alloc] initWithCustomView:btnTrans];

   //tempButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"btnAround.png"] style:UIBarButtonItemStyleDone target:self action:@selector(backBtnAction:)];

self.navigationItem.leftBarButtonItem = tempButton;

原文地址:https://www.cnblogs.com/zzxap/p/2175612.html