1
如果我想要更改UILabel
(yearLabel)screen.I使用UICollectionView
我应该怎么做。当collectionView
达到2014年我想要更改标签从2013年到2014年 我应该使用BOOL
property.But如何? 在cellForitemAtIndexPath
更改标题标签上滑动UICollectionView(在某些时候)
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView
cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell *myCell = [collectionView
dequeueReusableCellWithReuseIdentifier:@"cell"
UILabel *yearlabel=(UILabel*)[myCell viewWithTag:1221];
yearlabel.text=[yearArray objectAtIndex:indexPath.row];
if [(yearlabel isEqual:@"2014") ] {
_isLabelChange=YES;
}
}
return myCell;
和我yearArray
包含数据喜欢 -
yearArray=[[NSMutableArray alloc] initWithObjects:@"2013",@"2013",@"2013",@"2013",@"2013",@"2013",@"2013",@"2013",@"2014",@"2014",@"2014", nil];
请张贴您的代码。我没有多少能为你做盲人。 – topLayoutGuide
@cocotutch请看看我编辑过的问题 – user3422834
这应该是有效的,'indexPath.row'将根据表格中的单元格数量返回一个对象,并对其进行设置。除非你需要初始化'if(cell == nil){'块来解决这个问题。 – topLayoutGuide