iphone - 如何将 'Glow effect' 添加到 UIBarButtonItem 中?

标签 iphone ipad uibutton uibarbuttonitem glow

我尝试了很多方法来找出 UIBarButtonItem 的发光效果。现在我正在创建一个 UIButton 并将其作为 UIBarButton 的 customView。有没有人有任何其他方法可以使它更容易? (就像 UIBarButtonItem 的内置属性)

最佳答案

你的意思是触摸按钮时得到的效果?这是 UIButton 上的一个属性(也可以从 Interface Builder 访问);

@property(nonatomic) BOOL showsTouchWhenHighlighted

所以...

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

如果您编写 UIBarButtonItem 的子类并将此代码放在某处,那么重用它非常容易(而且不会困惑)。不知道还有没有其他办法。

关于iphone - 如何将 'Glow effect' 添加到 UIBarButtonItem 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4884538/

相关文章:

iphone - 如何自定义UITabBarController的 'More'按钮?

带有服务器后端的 iPhone 应用程序 - 如何确保所有访问仅来自 iPhone 应用程序?

iPhone + 轻微内存泄漏 + 应用程序崩溃

uitableview - 从选定行获取 PFObject 并保存到另一个解析类

ios - 不尊重 UIButton 的 backgroundImage 的内容模式

iphone - 在 iPhone 的 LinkedIn 集成中共享视频 URL

iphone - 尝试同时录制和播放音频,但很安静

iphone - 专业人员如何检索 iPhone 应用程序中的数据? (数据库)

iphone - 在 xcode 之外退出应用程序

iphone - 是否可以区分长按按钮和点击按钮?