2014-03-19 45 views
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]; 
+0

请张贴您的代码。我没有多少能为你做盲人。 – topLayoutGuide

+0

@cocotutch请看看我编辑过的问题 – user3422834

+0

这应该是有效的,'indexPath.row'将根据表格中的单元格数量返回一个对象,并对其进行设置。除非你需要初始化'if(cell == nil){'块来解决这个问题。 – topLayoutGuide

回答

0

只是检查的UIcollectionView标签属性和相应的设置。