Tag: uiprogressview

NSURLConnection didSendBodyData进度

我正在使用POST请求上传一些数据到服务器,我试图根据NSURLConnection的didSendBodyData方法的totalBytesWritten属性更新UIProgressView的进度。 使用下面的代码,我没有得到适当的进度视图更新,它始终为0.000,直到完成。 我不确定要乘以或除以获得更好的上传进度。 我会很感激提供的任何帮助! 码: – (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite { NSNumber *progress = [NSNumber numberWithFloat:(totalBytesWritten / totalBytesExpectedToWrite)]; NSLog(@"Proggy: %f",progress.floatValue); self.uploadProgressView.progress = progress.floatValue; }

在单元格中下载进度

我想在UITableViewCell里面开发一个进度视图。 在我的第一个实现中,我使用AFHTTPRequestOperation和它的setDownloadProgressBlock:^在我的单元格内。 后来我的目标变得更加复杂了。 我有一个UITableView显示不同的内容(歌曲播放列表)。 同一首歌曲可能会出现在几个播放列表中。 当我开始在一个播放列表中下载歌曲并切换到另一个(其中也包含这首歌曲)时,我想要看到第一个播放列表中的下载进度。 我已经成功地使它工作。 在下载过程开始时,我在全局类中创build了一个进度视图。 为了显示这个单元格的进度视图,我只使用addSubview removeFromSuperview 。 但我不喜欢这种方式,因为我必须在现有进度视图之上添加进度视图(因为每个单元都有自己的进度视图,因为应用程序devise)。 现在我使用另一种方法。 当我显示单元格时,我将setDownloadProgressBlock:^设置为现有的进度视图。 我工作正常,但是当我打开另一个播放列表时,进度显示在另一首歌曲上。 我敢打赌,这是因为我使用的可重复使用的细胞。 我有点厌倦了实现这个东西,任何想法如何使其正常工作?

用圆angular图像定制UIProgressView

我有两个图像自定义UIProgressView困难。 我在互联网上发现了很多有用的问题,但是我的问题有点不一样。 也许在某种程度上,我正在使用的图像是在没有angular的矩形上四舍五入; 因此, stretchableImageWithLeftCapWidth方法似乎没有帮助我的情况。 当我拉伸的图像,由于图像的圆angular有一些空间,有一个问题张贴在这个链接

UIProgressView不更新?

我已经开始在iOS5中使用UIProgressView,但没有真正运气。 我无法更新视图。 我有一套连续的行动,每次我更新进度后。 问题是,进度视图不是一点一点更新,而是完成之后。 它是这样的: float cnt = 0.2; for (Photo *photo in [Photo photos]) { [photos addObject:[photo createJSON]]; [progressBar setProgress:cnt animated:YES]; cnt += 0.2; } 浏览堆栈溢出,我发现这些post – setProgress不再更新UIProgressView自iOS 5以来 ,暗示为了这个工作,我需要运行一个单独的线程。 我想澄清这一点,我真的需要单独的线程为UIProgressView正常工作?

在导航栏下添加进度条

我是iOS开发新手。 我想知道是否在iOS 7中发送邮件时, UINavigationBar ,其标题为:发送,有一个进度条正在加载,直到消息成功发送。 我的问题是: 这个酒吧是一个进度条吗? 在iOS 6中,进度条在UINavigationBar ? 有人可以给我一些关于如何在iOS 7和iOS6上创build的想法吗? 我还没有尝试过任何东西。 我想阅读一些教程或这类问题的例子。 这是我的代码: int progress = 50; CGRect navframe = [[self.navigationController navigationBar] frame]; int height= navframe.size.height; sendView = [[UIView alloc] init]; sendView.frame = CGRectMake(0, 0, 200, 30); sendView.backgroundColor = [UIColor clearColor]; UILabel* lbl = [[UILabel alloc] init]; lbl.frame = CGRectMake(0,0, 200, 15); lbl.backgroundColor […]

如何使UITableViewCell上的UIProgressView立即改变?

我把一个UIProgressView放在UITableViewCell上,像这样: UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"downloadcell"]; if(cell==nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"downloadcell"] autorelease]; UIProgressView* downPreView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault]; downPreView.tag = 123; downPreView.frame = CGRectMake(400,70, 200,10); [cell.contentView addSubview:downPreView]; } 当下载大小发生变化时,我这样做: UIProgressView* downPreView = (UIProgressView*)[cell viewWithTag:123]; downPreView.progress = downloadPre; 但downPreView的外观不会立即改变,只有当我触摸单元格或其他单元格后,如何使UITableViewCell上的UIProgressView立即改变?

在UINavigationController的UINavigationBar内部或顶部显示一个UIProgressView

我想有一个UIProgressView在导航栏的底部显示进度(就像在iOS 7中发送iMessage或文本消息时一样)。 但是,我需要在我的导航控制器的每个表视图视图上一致。 所以对我来说很明显:我必须将其添加到UINavigationController。 但问题是,不可能将UIProgressView添加到UINavigationController。 所以我尝试了两件事情: 第一我试图以编程方式将其添加到UINavigationController的视图。 但问题是定位UIProgressView,并使其看起来不错,当改变设备的旋转。 我尝试的第二件事是将UIProgressView添加到每个UITableView,但是我真的必须为每个视图执行此操作。 它也不好看,因为它不在导航栏的顶部,而是在它的下面。 但是,我不喜欢第二种解决scheme的主要原因是因为ProgressViews与他们的TableView一起来,所以你没有一个静态的,但改变了。 在此之后,我没有任何想法做到这一点,所以我问你…有没有人有一个想法如何做到这一点? 这就是它应该是这样的:

更新UICollectionViewCell中的UIProgressView以获取下载文件

我试图更新UICollectionViewCell中的UIProgressView当我下载一个文件,但有时progressView更新和有时不更新,我不明白为什么,这是显示UICollectionViewCell的代码: -(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellIdentifier = @"documentCell"; UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath]; NSManagedObject *doc = [self.magDocument objectAtIndex:indexPath.row]; UIButton *btn = (UIButton *)[cell viewWithTag:2003]; [btn addTarget:self action:@selector(addDocument:) forControlEvents:UIControlEventTouchUpInside]; UIProgressView *progressBar = (UIProgressView *)[cell viewWithTag:2005]; return cell; } 这是开始下载的button: – (IBAction)addDocument:(id)sender { self.directCellPath = [self.myCollectionView indexPathForCell:(UICollectionViewCell *)[[sender superview] superview]]; NSManagedObject *document […]

是否可以在UIProgressView中添加多个颜色?

基本上,我想要创build一个自定义的progressview,根据进度值将有不同的颜色。 它应该如下所示: [—–红色—-] [ – 黄色 – ] [ – 绿色 – ]

UIView animateWithDuration和UIProgressView setProgress

我想在10秒内将我的UIProgressView进度从0增加到1。 码: [UIView animateWithDuration:10.0 animations:^{ [_myProgressView setProgress:1 animated:YES]; } completion:(BOOL finished)^{ if (finished) NSLog(@"animation finished); }]; animation工作正常,除了完成和NSLog总是立即调用。 我尝试了animateWithDuration: withDelay:但延迟不被尊重和立即执行。 有没有人遇到同样的问题? 感谢您的帮助。