ios在UITableView的标题视图中添加了一个collectionView(ios adding a collectionView inside UITableView's heade

编程入门 行业动态 更新时间:2024-10-10 07:22:22
ios在UITableView的标题视图中添加了一个collectionView(ios adding a collectionView inside UITableView's header view)

我在我的UITableView的headerView中有一个UICollectionView ,它是在其他xib文件(自定义视图)中创建的。 所以我的问题是,我应该在我声明我的tableView的同一个类上声明委托方法,还是在tableView标题的自定义视图上声明委托方法? 哪个更方便?

I've an UICollectionView inside the headerView of my UITableView which is made in other xib file (custom view) . So my question is, should I declare delegate methods on the same class I've declared my tableView or on the custom view which is header of tableView? Which is more convenient?

最满意答案

在同一个控制器中定义UITableView和UICollectionView的委托,将委托设置为同一个类

self.mytableview.delegate = self; self.mycollectionview.delegate = self;

您可以按照本教程, 将UICollectionView放在UITableViewCell中

Define the delegates of UITableView & UICollectionView in same controller, set there delegates to the same class as

self.mytableview.delegate = self; self.mycollectionview.delegate = self;

You can follow this tutorial, Putting a UICollectionView in a UITableViewCell

更多推荐

本文发布于:2023-08-08 00:38:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1466670.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:视图   标题   UITableView   ios   view

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!