源码简介
demo展示以行为主(row)的瀑布流样式视图,只支持ARC模式。
源码截图:
[[128131]]
源码片段:
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- BDRowInfo *ri = [_rowInfos objectAtIndex:indexPath.row];
- static NSString *CellIdentifier = @"Cell";
- BDDynamicGridCell *cell = [tableView dequeueReusableCellWithIdentifier:[CellIdentifier stringByAppendingFormat:@"_viewCount%d", ri.viewsPerCell]];
- if (!cell) {
- cell = [[BDDynamicGridCell alloc] initWithLayoutStyle:BDDynamicGridCellLayoutStyleFill
- reuseIdentifier:CellIdentifier];
- cell.viewBorderWidth = 1;
- UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(didLongPress:)];
- longPress.numberOfTouchesRequired = 1;
- [cell.gridContainerView addGestureRecognizer:longPress];
- UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didDoubleTap:)];
- doubleTap.numberOfTapsRequired = 2;
- doubleTap.delaysTouchesBegan = YES;
- [cell.gridContainerView addGestureRecognizer:doubleTap];
- UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didSingleTap:)];
- singleTap.numberOfTapsRequired = 1;
- singleTap.delaysTouchesBegan = YES;
- [cell.gridContainerView addGestureRecognizer:singleTap];
- [singleTap requireGestureRecognizerToFail:doubleTap];
- }
- //clear for updated list of views
- [cell setViews:nil];
- cell.viewBorderWidth = self.borderWidth;
- cell.backgroundColor = nil;
- cell.rowInfo = ri;
- NSArray * viewsForRow = [NSArray array];
- for (int i=0; i
0, @"number of views per row must be greater than 0"); - [cell setViews:viewsForRow];
- return cell;
- }
源码链接:http://down.51cto.com/data/1984619
上一篇:SDN 白盒 是赌博还是革命?
下一篇:豆瓣相册精选集 豆瓣相册大全集