以行为主的瀑布流视图

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

源码简介

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

源码截图:

[[128131]]

源码片段:

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

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

责任编辑:chenqingxiang 来源: 网络整理
相关推荐

2021-08-13 10:28:18

IT领导者CIO业务

2012-05-02 13:53:00

JavaScript

2012-07-30 09:48:32

设计管理

2011-03-14 15:56:37

NoSQL

2021-08-05 12:48:17

谷歌信息泄露漏洞

2012-06-15 09:35:42

JavaScript

2013-01-15 18:26:36

教育信息化

2016-06-23 19:45:06

青云QingCloudQingCloud I

2009-02-20 10:14:32

NehalemCore i7英特尔

2013-04-03 15:45:51

Android瀑布流android_wat

2022-05-27 16:40:24

软件开发DevSecOps

2021-04-17 10:29:18

DDoSDDoS攻击RDoS活动

2015-02-02 16:21:26

android瀑布流图片加载

2013-01-08 09:32:46

SaaSOracleSAP

2021-07-09 14:21:50

恶意软件REvil网络攻击

2013-05-09 10:18:28

鲍尔默Azure微软

2017-12-25 13:47:59

云计算多云混合云

2011-12-31 21:19:56

App Store

2023-05-10 09:04:10

promise场景业务
点赞
收藏

51CTO技术栈公众号