您好我正在开发一个具有uicollectionview的uitableview的iphone应用程序, 如何用ios 7做到这一点。
我只是想按照以下方式做,我认为我需要在tableviewcell中使用uicollectionview。
如果有人这样做,请帮助我。
如果您有任何其他想法,请回复我。
这是我试过的
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *identifier = @"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier forIndexPath:indexPath];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
Collectionclass *obj = [[Collectionclass alloc] init];
UICollectionViewFlowLayout *layout=[[UICollectionViewFlowLayout alloc] init];
UICollectionView *_collectionView=[[UICollectionView alloc] initWithFrame:self.view.frame collectionViewLayout:layout];
[_collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"cellIdentifier"];
[_collectionView setBackgroundColor:[UIColor redColor]];
[_collectionView setDataSource:obj];
[_collectionView setDelegate:obj];
[cell addSubview:_collectionView];
return cell;
}
答案 0 :(得分:0)
你可以试试这个gr8教程,即使它有源代码供你参考。它对我有用。
http://ashfurrow.com/blog/putting-a-uicollectionview-in-a-uitableviewcell
如果链接过期,请不要责怪。