加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

swift – 如何在UICollectionView的页脚中添加UIActivityIndi??c

发布时间:2020-12-14 04:56:05 所属栏目:百科 来源:网络整理
导读:如何在 swift中向UICollectionView的页脚添加UIActivityIndi??catorView?对于UITableView,它只是self.tableView.tableFootView = self.myActivityIndi??catorView.这可能吗?如果是这样,怎么样? 解决方法 在该视图中创建视图类并添加活动指示 使用以下命令
如何在 swift中向UICollectionView的页脚添加UIActivityIndi??catorView?对于UITableView,它只是self.tableView.tableFootView = self.myActivityIndi??catorView.这可能吗?如果是这样,怎么样?

解决方法

在该视图中创建视图类并添加活动指示

使用以下命令将此类注册为页脚视图类:

registerClass(myFooterViewClass,forSupplementaryViewOfKind: UICollectionElementKindSectionFooter,withReuseIdentifier: "myFooterView")

在集合视图布局或实现上设置headerReferenceSize

collectionView:layout:referenceSizeForHeaderInSection: in your delegate.

从dataSource中的以下方法返回页脚视图:

func collectionView(collectionView: UICollectionView,viewForSupplementaryElementOfKind kind: String,atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView {
let view = collectionView.dequeueReusableSupplementaryViewOfKind(UICollectionElementKindSectionFooter,withReuseIdentifier: "myFooterView",forIndexPath: indexPath)
// configure footer view
return view
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读