UIProgressView在UICollectionViewCell中的setFrame时不能正确工作
我在UICollectionViewCell中创build一个UIProgressView,我尝试为UIProgressView设置框架来更改UICollectionViewCell中的位置,但是当这样做时,一些单元格不显示progressView。 当我删除setFrame时,没问题,但在UICollectionViewCell顶部的默认宽度
有什么问题?如何更改UIProgressView的大小,来源? 请帮忙!
//Cell:UICollectionViewCell //Cell.m - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { //ProgressView self.progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleBar]; [self.progressView setFrame:progressViewFrame];//Some cells not display progressView [self.progressView addSubview:self.downloadBar]; } return self; }
我修改了你的代码。 现在,进度视图正常工作。 所有单元格都显示进度视图。 另外,如果在下面的代码中更改self.downloadB
的框架,则可以修改单元格的宽度和位置
- (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { // Initialization code [self.contentView setBackgroundColor:[UIColor underPageBackgroundColor]]; //cellImage self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(100, 0, 57, 57)]; [self.imageView setBackgroundColor:[UIColor clearColor]]; [self.contentView addSubview:self.imageView]; //ProgressView self.downloadBar = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleBar]; [self.downloadBar setFrame:CGRectMake(0, 10, 300, 10)]; [self.contentView addSubview:self.downloadBar]; [self.downloadBar setHidden:YES]; self.receivedData = [[NSMutableData alloc] init]; } return self; }
我已经从你提供的github url修改了cell.m的代码。
- MFMessageComposeViewController iOS7 addAttachmentData:typeIdentifier:文件名:不工作
- 使用Mapbox和Unity3d的地图上的3D路径
- Alloc – 作为accessoryView添加 – 释放:它泄漏吗?
- 将URL数据保存到variables
- 在iOS中logging所有3个麦克风
- 将额外的行添加到由NSFetchedResultsControllerpipe理的UITableView
- iOS自定义TableViewCell类子视图返回null
- 委托方法不被称为客观的C
- UICollectionView contentOffset随自定义布局而变化