【发布时间】:2015-09-11 03:48:07
【问题描述】:
我的代码:
-(void)setupRightMenuButton{
filtro = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"icon-filtro-bar"] style:UIBarButtonItemStylePlain target:self action:@selector(buttonFilter)];
busca = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"icon-busca"] style:UIBarButtonItemStylePlain target:self action:@selector(moveToSearchView)];
filtro.tintColor = [UIColor whiteColor];
busca.tintColor = [UIColor whiteColor];
filtro.imageInsets = UIEdgeInsetsMake(6, 0, -6, 0);
busca.imageInsets = UIEdgeInsetsMake(6, 0, -6, 0);
[self.navigationItem setRightBarButtonItems:[NSArray arrayWithObjects:busca, filtro, nil] animated:YES];
}
我的 viewDidLoad:
- (void)viewDidLoad {
[super viewDidLoad];
[self setupLeftMenuButton];
[self.navigationController.navigationBar setBarTintColor: [UIColor colorWithRed:0.49 green:0.075 blue:0.082 alpha:1]]; /*#7d1315*/
[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)
forBarMetrics:UIBarMetricsDefault];
[self setupRightMenuButton];
self.title = @"Músicas";
}
我尝试使用filtro.imageInsets = UIEdgeInsetsMake (6, 0, -6, 0);,但没有成功
【问题讨论】:
-
你有没有在这两者之间添加任何间隔?
-
尝试将按钮添加到导航栏而不是执行“setRightBarButtonItems”
-
您是否尝试过更改 UIOffsetMake(0, -60) 中的偏移值?我不知道你为什么给价值 -60
标签: ios objective-c iphone uitabbar uitabbaritem