开发者

Tapping on UIBarButtonItem

I want a button tap effect for a UIBarButtonItem. My navigation bar has black tint color:

[self.navigationController开发者_StackOverflow.navigationBar setTintColor:[UIColor blackColor]];

So when I tap on any UIBarButtonItem on it, I do not get a button tapping effect. If I change the tint color to some other color like gray, it works. But I want only the black color there in the tint.

When you tap on a button, it color fades and you feel the tapping effect. That is because of touchUpInside action associated with UIButton class but nothing such event is there with UIBarButtonItem. I can get that effect with UIBarButtonItem if I set the Tint color of Navigaiton bar to other than black or dark gray.

Any suggestions.


You can always set your UIBarButtonItem custom view to a UIButton, then youll have whatever effect from UIButton that you like...


I got this done by setting the nav bae style:

myController.navigationBarStyle = UIBarStyleBlackOpaque;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜