[英]How can I add the 'Glow effect' to UIBarButtonItem?
我尝试了很多来找出UIBarButtonItem的发光效果。 现在我正在创建一个UIButton并将其作为UIBarButton的customView。 有没有人有任何其他方法可以让它更容易? (就像UIBarButtonItem的内置属性)
你的意思是你触摸按钮时的效果? 这是UIButton上的属性(也可以从Interface Builder访问);
@property(nonatomic) BOOL showsTouchWhenHighlighted
所以...
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.showsTouchWhenHighlighted = YES;
如果您编写UIBarButtonItem的子类并将此代码放在某处,则重新使用它非常容易(而不是凌乱)。 我不确定是否还有其他办法。
你有没有尝试过
- (id)initWithImage:(UIImage *)image style:(UIBarButtonItemStyle)style target:(id)target action:(SEL)action
使用UIBarButtonItemStylePlain
作为按钮样式
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.