【发布时间】:2014-04-15 17:15:29
【问题描述】:
我的应用程序的第一个视图是 UICollectionView,我将 Cell 推送到具有五个视图的 TabBarController,但是当我更改每个视图的标题时没有出现问题。所以我需要给这五个viewController分别取一个不同的title。
CollectionView.m 是:
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"cell";
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
productName *data = [self.productarray objectAtIndex:indexPath.item];
UIImageView *imageView = (UIImageView *)[cell viewWithTag:100];
imageView.image = data.productImage;
UILabel *title2 = (UILabel *)[cell viewWithTag:200];
title2.text = data.productNames;
return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
ProductsViewController *detail = [[ProductsViewController alloc]init];
//[self.view pushViewController:detail animated:YES];
detail.productNumber = indexPath.item;
//NSLog(@"%d", indexPath.item);
}
【问题讨论】:
-
你能把问题说清楚点吗?您的实际问题是什么 - 单元格或视图控制器未显示详细信息?您还继承
UICollectionViewCell并创建自定义imageView 和标签? -
我的问题是我的第一个 viewController 是 uicollectionViewController,我用五个不同的 viewController 装到 tabbarViewController 但我需要为每个 viewController 放置不同的标题和 itemBarButton
标签: ios objective-c ios6 uitabbarcontroller uicollectionview