开发者

in iPhone SDK How to change the color of BarButton Item

How to change color of leftBarButtonItem of UIBarButtonItem in NavigationBar?

if I am trying to set image in bar button through interfaceBuilder it shows border on image in bar button so is there any specific size for image for bar button or how to set image with-out showing border in it ?

If I am adding BarButton dynamically it doesn"t appear while running App and if I am adding leftbarButton in xib only and connecting outlets th开发者_StackOverflowen the leftbar button become visible but I am not able to assign customview view to it my ultimate goal is to change the color of left bar buttton

Please Help and Suggest, Thanks


Create the bar buttom item with a custom view using -[UIBarButtonItem initWithCustomView:]. That way, you have all the control you want over the appearance.


I think you can use:

- (id)initWithImage:(UIImage *)image style:(UIBarButtonItemStyle)style target:(id)target action:(SEL)action

You can set custom image for your bar button.


If it's just the colour you want to change, add the button to the bar and then set the tint colour of the bar (see docs on UINavigationBar or UIToolBar). This of course changes the bar colour as well as the button however, but it's good practice (UI consistency wise) to use the same colour for UIBarButtonItems and their bars especially if you're using out-of-the-box buttons.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜