以行为主的瀑布流视图
创始人
2025-01-10 16:41:32
0次

源码简介

demo展示以行为主(row)的瀑布流样式视图,只支持ARC模式。

源码截图:

[[128131]]

源码片段:

  1. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
  2. { 
  3.     BDRowInfo *ri = [_rowInfos objectAtIndex:indexPath.row]; 
  4.     static NSString *CellIdentifier = @"Cell"; 
  5.     BDDynamicGridCell *cell = [tableView dequeueReusableCellWithIdentifier:[CellIdentifier stringByAppendingFormat:@"_viewCount%d", ri.viewsPerCell]]; 
  6.       
  7.     if (!cell) { 
  8.         cell = [[BDDynamicGridCell alloc] initWithLayoutStyle:BDDynamicGridCellLayoutStyleFill 
  9.                                               reuseIdentifier:CellIdentifier]; 
  10.           
  11.         cell.viewBorderWidth = 1; 
  12.           
  13.         UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(didLongPress:)]; 
  14.         longPress.numberOfTouchesRequired = 1; 
  15.         [cell.gridContainerView addGestureRecognizer:longPress]; 
  16.           
  17.         UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didDoubleTap:)]; 
  18.         doubleTap.numberOfTapsRequired = 2; 
  19.         doubleTap.delaysTouchesBegan = YES; 
  20.         [cell.gridContainerView addGestureRecognizer:doubleTap]; 
  21.           
  22.         UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didSingleTap:)]; 
  23.         singleTap.numberOfTapsRequired = 1; 
  24.         singleTap.delaysTouchesBegan = YES; 
  25.         [cell.gridContainerView addGestureRecognizer:singleTap]; 
  26.         [singleTap requireGestureRecognizerToFail:doubleTap]; 
  27.     } 
  28.       
  29.     //clear for updated list of views 
  30.     [cell setViews:nil]; 
  31.     cell.viewBorderWidth = self.borderWidth; 
  32.     cell.backgroundColor = nil; 
  33.   
  34.     cell.rowInfo = ri; 
  35.     NSArray * viewsForRow = [NSArray array]; 
  36.     for (int i=0; i 0, @"number of views per row must be greater than 0"); 
  37.     [cell setViews:viewsForRow]; 
  38.       
  39.     return cell; 
  40. } 

源码链接:http://down.51cto.com/data/1984619

相关内容

热门资讯

PHP新手之PHP入门 PHP是一种易于学习和使用的服务器端脚本语言。只需要很少的编程知识你就能使用PHP建立一个真正交互的...
网络中立的未来 网络中立性是什... 《牛津词典》中对“网络中立”的解释是“电信运营商应秉持的一种原则,即不考虑来源地提供所有内容和应用的...
各种千兆交换机的数据接口类型详... 千兆交换机有很多值得学习的地方,这里我们主要介绍各种千兆交换机的数据接口类型,作为局域网的主要连接设...
粉嫩如何诠释霸道 东芝M805... “霸道粉”是个什么玩意东芝M805拿过来的时候,笔者扑哧笑了,不是笑这款笔记本,而是笑这款产品的颜色...
如何利用交换机和端口设置来管理... 在网络管理中,总是有些人让管理员头疼。下面我们就将介绍一下一个网管员利用交换机以及端口设置等来进行D...
什么是大数据安全 什么是大数据... 在《为什么需要大数据安全分析》一文中,我们已经阐述了一个重要观点,即:安全要素信息呈现出大数据的特征...
只需三步,让你掌握阿尔法路由器... 请参照以下阿尔法路由器设置方法,通过浏览器进入及设置宽带路由器。经过这三个步骤的设置,基本上能够熟悉...
全面诠释网络负载均衡 负载均衡的出现大大缓解了服务器的压力,更是有效的利用了资源,提高了效率。那么我们现在来说一下网络负载...
如何允许远程连接到MySQL数... [[277004]]【51CTO.com快译】默认情况下,MySQL服务器仅侦听来自localhos...
Windows恶意软件20年“... 在Windows的早期年代,病毒游走于系统之间,偶尔删除文件(但被删除的文件几乎都是可恢复的),并弹...