对于在View Collection中创建的每个单元格,我需要ProgressView
。我正在使用一个模块,它实际上是一个视图,这就是为什么我指的是UIView
。
我有一切正常,除了下载它只触发特定进度视图的最后一个实例的事实。
我可以通过创建NSMutableArray
来解决此问题,插入ProgressView
的所有实例,以便保存它。
然后,一旦点击按钮,我就可以参考该单元格内的确切特定进度视图。
不幸的是,它没有将它们添加到数组中。我删除了所有不必要的代码,只剩下我正在使用的代码:
在我的.h
文件中:
@property (strong, nonatomic) IBOutletCollection(UIView) NSMutableArray *dldinges;
然后继续前进UICollectionViewCell
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
// cell.downloadProgressCircle comes from my UICollectionViewCell.h
UIView *currentCell = cell.downloadProgressCircle;
[dldinges insertObject:currentCell atIndex:indexPath.row];
NSLog(@"Cell: %@",currentCell);
NSLog(@"Collection: %@",dldinges);
}
然后点击按钮:
- (IBAction)buttonClicked:(id)sender {
CGPoint buttonPosition = [sender convertPoint:CGPointZero toView:self.IssuesOverviewCollection];
NSIndexPath *indexPath = [self.IssuesOverviewCollection indexPathForItemAtPoint:buttonPosition];
UIView *progressButton = [[UIView alloc]init];
progressButton = [dldinges objectAtIndex:indexPath.row];
progressButton.percentage = 0.5;
}