iOS 为 UIBarButtonItem 图像添加了哪些效果?
iOS 为 UIBarButtonItem
图像添加了哪些效果?我想将三个“按钮”放在 UISegmentControl
段中以直观地对它们进行分组。但是,UISegmentControl
并未添加与 UIBarButtonItem
相同的效果。
UIBarButtonItem 中的图像上方似乎有一个黑色阴影,但我通过实验无法匹配它。
我不介意在代码或图形编辑器中执行此操作,但我更喜欢代码。 :)
苹果的文档是这么说的,我认为这是相同的基本方法:
表示项目正常和突出显示状态的工具栏图像源自您使用 UIBarItem 类继承的图像属性设置的图像。例如,将图像转换为白色,然后通过为正常状态添加阴影来进行斜角处理。
我主要关心的是匹配阴影;底色不是黑色,我不知道不透明度。
What effects does iOS add to UIBarButtonItem
images? I want to put three of my "buttons" in a UISegmentControl
segment to visually group them. However, UISegmentControl
does not add the same effects that UIBarButtonItem
does.
There seems to be a black shadow just above the image in the UIBarButtonItem
, but I haven't been able to match it through experimentation.
I don't mind doing this in code or in a graphic editor, though I'd prefer code. :)
Apple's docs say this, which I assume is the same basic approach:
Toolbar images that represent normal and highlighted states of an item derive from the image you set using the inherited image property from the UIBarItem class. For example, the image is converted to white and then bevelled by adding a shadow for the normal state.
My main concern is matching the shadow; the base colour is not black, and I don't know the opacity.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论