-
(UITableViewCell )tableView:(UITableView )tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *identifier2 = @"buildCellidentifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier2]; if (!cell){ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier2]; }else{ while ([cell.contentView.subviews lastObject] != nil) { [(UIView*)[cell.contentView.subviews lastObject] removeFromSuperview]; } } cell.selectionStyle = UITableViewCellSelectionStyleNone; CGRect collectionFrame = CGRectMake(0, 48+[Utility transformAlgY:18.5], SCREEN_WIDTH, [Utility transformAlgY:190]); CellLayout *layout =[[CellLayout alloc] initWithStyle:[Utility transformAlgY:190] andWidth:[Utility transformAlgX:109] andTopBottom:15.5 andLeftRight:12 andItemSpace:12 andLineSpace:15.5]; [layout setScrollDirection:UICollectionViewScrollDirectionHorizontal]; UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:collectionFrame collectionViewLayout:layout]; collectionView.backgroundColor = BACK_COLOR; collectionView.delegate = self; collectionView.dataSource = self; collectionView.alwaysBounceVertical = NO; collectionView.showsHorizontalScrollIndicator = NO; [collectionView registerClass:[MovieSingleCell class] forCellWithReuseIdentifier:@"HuDiSingle"]; [cell.contentView addSubview:collectionView]; return cell; }
这样子会有一个问题就是 一开始UICollectionView上的东西不显示 只有tableview滑动一下后才会显示 这是为什么 该如何解决呢