首页 > 代码库 > iOS 开发之 - iOS6适配 - 导航栏按钮透明方法

iOS 开发之 - iOS6适配 - 导航栏按钮透明方法

首先上张图:

1:ios6导航栏默认按钮 

rightBarButtonItem

  是不是很丑的赶脚?

现在通过以下方法来改变以下;code:

  UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeCustom];    rightButton.frame = CGRectMake(0, 0, 40, 40);    [rightButton setTitle:@"提交" forState:UIControlStateNormal];    [rightButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];    [rightButton addTarget:self action:@selector(buttonClick) forControlEvents:UIControlEventTouchUpInside];   self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightButton];

 

如图:

 

 

ok.好看多了。