自定义导航栏按钮(左侧)

//创建自定义视图
UIView *vs = [[UIView alloc] initWithFrame:CGRectMake(2, 2, 60, 40)];
//设置自定义视图的背景颜色
vs.backgroundColor = [UIColor redColor];
//加载自定义视图
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:vs];

编程技巧