- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要为 UIBarButtonItem 添加角标(Badge)和红点,因为框架很难获得(它不是 View ),所以我想使用带有自定义 View 的 UIBarButtonItem。目前 UIBarbuttonItem 是使用方法 initwithimage 初始化的,我喜欢 Apple 文档中描述的默认行为:
The images displayed on the bar are derived from this image. If this image is too large to fit on the bar, it is scaled to fit. Typically, the size of a toolbar and navigation bar image is 20 x 20 points. The alpha values in the source image are used to create the images—opaque values are ignored.
所以,我的问题是如何使用自定义 View 实现上述逻辑。即如何解析图像,将alpha值替换为tint颜色值?
或者换个思路,有没有安全可靠的方法获取UIBarButtonItem相对于UIToolbar或者UINavigationBar的位置/frame?
提前致谢。
最佳答案
d使用 - (id)initWithCustomView:(UIView *)customView
并使用包含图像和角标(Badge)的 View 作为 customView。
对于色调颜色,您应该看看这篇文章:http://robots.thoughtbot.com/designing-for-ios-blending-modes
关于ios - 如何使用自定义 View 创建 UIBarButtoneItem 但模仿 UIBarButtoneItem initwithimage 行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23157422/
我需要为 UIBarButtonItem 添加角标(Badge)和红点,因为框架很难获得(它不是 View ),所以我想使用带有自定义 View 的 UIBarButtonItem。目前 UIBarb
我是一名优秀的程序员,十分优秀!