2011-02-03 60 views

回答

8

你的意思是,你得到的效果,當你觸摸一個按鈕嘗試

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

的按鈕樣式?這是UIButton上的屬性(也可以從Interface Builder訪問);

@property(nonatomic) BOOL showsTouchWhenHighlighted 

所以......

UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 
button.showsTouchWhenHighlighted = YES; 

如果你寫的UIBarButtonItem的一個子類,並把這個代碼在那裏的地方它是很容易(而不凌亂)重新使用它。我不確定是否有其他方法。

+1

朋友,我知道使UIButton發光的方法。問題是如何在沒有custon的情況下向UIBarButton添加發光效果查看UIButton。 – thoughtbreaker 2011-02-04 02:33:36

0

你有沒有使用UIBarButtonItemStylePlain