制作一个明确的(transluscent)UIBarButttonItem IOS 5 [英] Make a clear(transluscent) UIBarButttonItem IOS 5
本文介绍了制作一个明确的(transluscent)UIBarButttonItem IOS 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用以下代码为UIBarButtonItem设置色调颜色,但我得到的只是一个黑色按钮。有没有办法做到这一点,而无需使用自定义图片
I am trying to set the tint color for a UIBarButtonItem using the following code, but all I get is a black button. Is there a way to accomplish this without the need to use custom images?
[[UIBarButtonItem appearance] SetTintColor:[UIColor clearColor]]:
推荐答案
创建自定义的UIBarButtonItem与按钮
create a custom UIBarButtonItem with a button
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setImage:buttonImage forState:UIControlStateNormal];
//set the frame of the button to the size of the image (see note below)
button.frame = CGRectMake(0, 0, 24, 24);
button.backgroundColor=[UIColor clearColor];
//create a UIBarButtonItem with the button as a custom view
UIBarButtonItem *customBarItem = [[UIBarButtonItem alloc] initWithCustomView:button];
这篇关于制作一个明确的(transluscent)UIBarButttonItem IOS 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文