自定义 IKImageBrowserView 组外观
我正在尝试更改 IKImageBrowserView 组标题的外观。 我已经看到我们可以使用 IKImageBrowserGroupHeaderLayer 提供自定义 CALayer 但我根本不知道如何使用它(如何获取图层的大小,知道是否选择了组,....
)指针这个?
谢谢
I am trying to change the appearance of the group header of an IKImageBrowserView.
I've seen that we can provide an custom CALayer with IKImageBrowserGroupHeaderLayer but I do not know at all how to use it (how to get the size of the layer, know if the group is selected, ....)
Do you have any pointer for this?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我今天尝试了一下,它看起来相当简单。但值得注意的是,它似乎仅适用于 IKImageGroupDisclosureStyle 组。
这在每组的顶部提供了一条漂亮的粉红色线。看来,当视图显示图层时,它会将图层大小调整为浏览器视图的宽度,因此我在
bounds
中输入的width
对结果没有任何影响,但是它确实尊重高度
。关于“知道是否选择了该组”,我假设您的意思是是否选择了该组中的一项?我会观察视图的
selectionIndexes
的变化,确定选择了哪个或哪些项目,然后确定它们属于哪个组(使用与在以下情况下提供IKImageBrowserGroupRangeKey
类似的过程)配置组,我希望您已缓存!)并调用reloadData
,其中一个组根据是否包含所选项目返回不同的图层配置(或其他内容)。I have had a go at this today and it appeared reasonably straightforward. It was important to note, however, that it appears to only work with
IKImageGroupDisclosureStyle
groups.This provided a nice pink line along the top of each group. It seems that when the view displays the layer, it resizes the layer to the width of the browser view, so what I put in
width
forbounds
made no difference to the result, however it does honourheight
.Regarding "know if the group is selected", I assume you mean if one of the items within the group is selected? I would observe the view's
selectionIndexes
for changes, determining which item or items were selected, then determining in which group they fall (using a similar process to how you provided theIKImageBrowserGroupRangeKey
when configuring the group, which I hope you have cached!) and callingreloadData
with one of the groups returning a different layer configuration (or whatever) based on whether it contains a selected item or not.