简体   繁体   English

如何在集合视图中禁用重新加载

[英]How to disable the reload in collection view

I am having UI collection view multiple cells.I am dynamically showing data from the web service.Whenever I scroll the collection view the data automatically changing.I want to disable the feature. 我正在UI集合视图中查看多个单元格。我正在动态显示Web服务中的数据。每当我滚动集合视图时,数据就会自动更改。我想禁用该功能。

My code. 我的代码。

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    //return [names count];
    return myObject.count;
}

- (UIView *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    CollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"CELL" forIndexPath:indexPath];
     NSString*  statusfield = [NSString stringWithFormat:@"%@",[tmpDict objectForKey:@"StatusId"]];
      if([statusfield isEqualToString:@"13"])
    {
         [cell.mySegmentedControl setTitle:@"SEND TO ADMIN" forSegmentAtIndex:0];
         [cell.mySegmentedControl setTitle:@"EVALUATE" forSegmentAtIndex:1];
    }
    if([statusfield isEqualToString:@"5"])
    {
       [cell.mySegmentedControl setEnabled:NO forSegmentAtIndex:0];
       [cell.mySegmentedControl setEnabled:NO forSegmentAtIndex:1];
    }
    if([statusfield  isEqualToString: @"1"])
    {
        [cell.mySegmentedControl setTitle:@"ACCEPT" forSegmentAtIndex:0];
        [cell.mySegmentedControl setTitle:@"REJECT" forSegmentAtIndex:1];
    }
}

when I scroll the mycollection view.The above segments values automatically changed because of reload function.Any help will be appreciated. 当我滚动mycollection视图时,由于重新加载功能,上述段的值自动更改。任何帮助将不胜感激。

此方法可以帮助您根据您的项目重新加载数据。

- (void)reloadItemsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM