collectionView,tableView的细节处理】的更多相关文章

1.设置collectionView的高度 1.1为什么要设置高度? collectionView是在tableView的footView里面 , tableView能滚动,collectionView也能滚动 我们不想让collectionView滚动 1.2怎么可以让collectionView不滚动? 只要collectionView里面的内容不超出collectionView的最大高度就可以了 1.3怎么设置collectionView的高度 计算出collectionView内容高度…
collectionView/tableview reloadSections/reloaddata时去掉动画无效时可以尝试使用 [UIView performWithoutAnimation:^{ [_collectionView reloadSections:[NSIndexSet indexSetWithIndex:2]]; //刷新操作 }];…
滑动时,tableview中的headerView 的frame不断改变,collectionView的headerView的center不断改变.sotableview: -(void)setFrame:(CGRect)frame{ [super setFrame:frame]; CGRect rect = [self.superview convertRect:frame toView:[UIApplication sharedApplication].keyWindow]; if (rec…
https://www.jianshu.com/p/ec29feb0b5a6 2017.07.27 11:48* 字数 424 阅读 615评论 9喜欢 11 demo地址:https://github.com/feng562925462/ExamModule   考试答题效果示例.gif 小编在深圳的一家专注于教育软件的企业工作,原来考试模块是加载的web,但是考虑到性能流畅度,近期改成原生,花了一些时间去写了一下这个demo,只是因为公司忙于其他事情,就一直没发出来,刚好有一点时间稍微整理一…
UIScrollViewDelegate 方法调用 /** 设置缩放的View, 初始化完之后调用此方法告诉scrollView 谁可以缩放操作, 然后进行布局 */ func viewForZoomingInScrollView(scrollView: UIScrollView) -> UIView? { print("viewForZoomingInScrollView") return imageView } /** 缩放进行中调用 */ func scrollViewDi…
做了一段时间的iOS,在菜鸟的路上还有很长的路要走,把遇到的问题记下来,好记性不如烂笔头. 在项目开发中大家经常会用到tableView和collectionView两个控件,然而在cell的自定义上会有一定的不同 tableView 1.纯代码自定义cell,直接用init方法自定义,然后在UITableViewCell* 里面自己根据标识加载 -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(N…
首先是自定义collectionView填充的tableViewCell import UIKit // 定义一个collectionView,重写初始化大小和布局方法 class TrendsDetailZanCollectionView: UICollectionView { var indexPath: NSIndexPath! override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout)…
#import "ViewController.h" #define HEIGHT [UIScreen mainScreen].bounds.size.height #define WIDTH [UIScreen mainScreen].bounds.size.width @interface ViewController ()<UICollectionViewDelegate,UICollectionViewDataSource,UITableViewDelegate,UITa…
相信好多人一定会对collectionView和tableView的两种cell出列方法有所疑问,下面以UICollection为例子进行举例说明 假设我们已经创建了一个collectionView,下面的1和2到底有什么区别呢 #define COLLECT_CELL_ID @"collectionCellId" 1.[self.collectionView dequeueReusableCellWithReuseIdentifier:COLLECT_CELL_ID]; 2.[sel…
项目中的警告是不会影响app发布的,例如引入第三方类库很容易引入警告. 细节1:跳转的数据传递. prepareForSegue: sender: 方法是在执行segue后,跳转之前调用这个方法,一般在这里给下一个控制器传递数据. 可以直接在这里获取目标控制器:如果只是简单的修改,不必一定写成真实的控制器类型 UIViewController *contactVc = segue.destinationViewController; 这样就可以修改目标视图的内容了. Tip:控制器的title属…