Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"photoCell"];
- PhotoCell *photoCell = (PhotoCell *)cell;
- if(indexPath.row==self.resultArray.count-1 && self.onEdit){
- self.onEdit = NO;
- [photoCell.resultImageV setHidden:YES];
- float rand = 5 + arc4random_uniform(26);
- photoCell.time=0.0;
- photoCell.totalTime = rand/50;
- NSLog(@"loading---%@---time>>%f", indexPath, rand);
- NSTimer *timer = [NSTimer timerWithTimeInterval:0.5f target:self selector:@selector(updateTimer:) userInfo:photoCell repeats:YES];
- [[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
- UIProgressView *progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleBar];
- progressView.frame = CGRectMake(0, photoCell.resultImageV.frame.size.height/2, photoCell.resultImageV.frame.size.width, photoCell.resultImageV.frame.size.height);
- [progressView setTag:11];
- [photoCell.contentView addSubview:progressView];
- }
- UIImage *img = (UIImage *)[self.resultArray objectAtIndex:indexPath.row];
- photoCell.resultImageV.image = img;
- return cell;
- PhotoCell *cell = timer.userInfo; //index of tableview for current timer
- if(cell.time >= cell.totalTime)
- {
- UIProgressView *prg = [cell viewWithTag:11];
- [prg removeFromSuperview];
- [cell.resultImageV setHidden:NO];
- [timer invalidate];
- }
- else
- {
- cell.time += 0.01;
- float progress = cell.time/cell.totalTime;
- UIProgressView *prg = [cell viewWithTag:11];
- prg.progress = progress;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement