- UIImage* image= [UIImage imageNamed:@"绑定弹出-返回.png"];
- CGRect frame_1= CGRectMake(0, 0, image.size.width, image.size.height-4);
- UIButton* backButton= [[UIButton alloc] initWithFrame:frame_1];
- [backButton setBackgroundImage:image forState:UIControlStateNormal];
- [backButton setTitle:@"返回" forState:UIControlStateNormal];
- [backButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- backButton.titleLabel.font=[UIFont systemFontOfSize:16];
- [backButton addTarget:self action:@selector(doBack:) forControlEvents:UIControlEventTouchUpInside];
- //定制自己的风格的 UIBarButtonItem
- UIBarButtonItem* someBarButtonItem= [[UIBarButtonItem alloc] initWithCustomView:backButton];
- [self.navigationItem setLeftBarButtonItem:someBarButtonItem];
- [someBarButtonItem release];
- [backButton release];
定制navgation上的按钮,设置自己的风格的UIBarButtonItem
最新推荐文章于 2021-03-21 22:05:27 发布