我怎样才能在我的应用程序中简单地使用进度视图
How can i simply used progress view in my app
我正在尝试使用以下代码将图像从我的应用程序保存到相册:
-(void)download:(UIButton *)downloadbtn{
j=320*downloadbtn.tag;
selectedIndex=downloadbtn.tag;
NSData *data=[NSData dataWithContentsOfURL:[NSURL URLWithString:[live_god_img objectAtIndex:selectedIndex]]];
UIImage*img=[UIImage imageWithData:data];
UIImageWriteToSavedPhotosAlbum(img, self, nil, nil);
UIAlertView*alert=[[UIAlertView alloc]initWithTitle:@"Success..!" message:@"Image Saved to the Photos" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
[alert show];
}
当图像保存到相册时,会显示一个警告视图,但我想在图像保存到相册时显示一个进度视图。我不知道如何使用UIProgressView
。我该怎么做?
完成本教程first
你可以在你的方法中这样尝试。
- (IBAction)startProgress:(id)sender
{
progressValue = 0.0f;
[self increaseProgressValue];
}
-(void)increaseProgressValue
{
if(progressView.progress<1)
{
progressValue = progressValue+0.1;
progressView.progress = progressValue;
[self performSelector:@selector(increaseProgressValue) withObject:self afterDelay:0.2];
}
}
我正在尝试使用以下代码将图像从我的应用程序保存到相册:
-(void)download:(UIButton *)downloadbtn{
j=320*downloadbtn.tag;
selectedIndex=downloadbtn.tag;
NSData *data=[NSData dataWithContentsOfURL:[NSURL URLWithString:[live_god_img objectAtIndex:selectedIndex]]];
UIImage*img=[UIImage imageWithData:data];
UIImageWriteToSavedPhotosAlbum(img, self, nil, nil);
UIAlertView*alert=[[UIAlertView alloc]initWithTitle:@"Success..!" message:@"Image Saved to the Photos" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
[alert show];
}
当图像保存到相册时,会显示一个警告视图,但我想在图像保存到相册时显示一个进度视图。我不知道如何使用UIProgressView
。我该怎么做?
完成本教程first
你可以在你的方法中这样尝试。
- (IBAction)startProgress:(id)sender
{
progressValue = 0.0f;
[self increaseProgressValue];
}
-(void)increaseProgressValue
{
if(progressView.progress<1)
{
progressValue = progressValue+0.1;
progressView.progress = progressValue;
[self performSelector:@selector(increaseProgressValue) withObject:self afterDelay:0.2];
}
}