- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
NSMutableDictionary *tabsDict = [tabs objectAtIndex:indexPath.row];
NSString *identifier = [tabsDict objectForKey:@"destination"];
NSString *title = [tabsDict objectForKey:@"name"];
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
UILabel *label = (UILabel *)[cell viewWithTag:10];
label.text = title;
return cell;
}当我运行我的应用程序时,UILabel无法识别,因此在单元格的标签中没有显示任何文本。有人能解释一下为什么不是吗?我刚开始在Xcode6中遇到这个问题。
发布于 2015-05-22 14:47:39
发布于 2015-01-06 23:36:53
我今天一直在努力解决这个问题,最后尝试查找这个Xcode6的bug。
这个用户的解决方案对我来说很有效,尽管他是用swift编码的。
https://stackoverflow.com/a/25535121/4385189
在不同的自动布局和屏幕大小的上/下采样中,我们试图用viewWithTag获取的视图似乎不再是this视图的子视图。我还需要将故事板下面的自动布局选择器更改为wAny hAny,也就是所有大小的baselayout。
https://stackoverflow.com/questions/25923386
复制相似问题