我想知道,在这种情况下如何显示 UIProgressView:我使用 UIImagePickerController 拍摄照片,然后在方法- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
中将图片保存到 UIImage 对象(outputImage)并隐藏控制器,当带有相机的 modalView/controller 消失时,我有这样的代码:
NSLog(@"Image is width: %f height: %f", outputImage.size.width, outputImage.size.height);
//FLIP PICTURE FROM FACETIME CAMERA
if((outputImage.size.width == 480 && outputImage.size.height == 640) || (outputImage.size.width == 640 && outputImage.size.height == 480)) {
outputImage = [UIImage imageWithCGImage:outputImage.CGImage
scale:1.0 orientation: UIImageOrientationLeftMirrored];}
//RESIZE TO 1000x1000
outputImage = [self scaleAndCropToSize:outputImage toSize:CGSizeMake(1000, 1000)];
NSLog(@"Now image is width: %f height: %f", outputImage.size.width, outputImage.size.height);
//CUTING OUT TO MASK
outputImage = [self maskImage:outputImage withMask:[UIImage imageNamed:@"mask.png"]];
//ADDING SHADOW
CGSize size = CGSizeMake(1000, 1000);
UIGraphicsBeginImageContext(size);
CGPoint thumbPoint = CGPointMake(0, 0);
[outputImage drawAtPoint:thumbPoint];
UIImage* shadow = [UIImage imageNamed:@"shadow.png"];
CGPoint starredPoint = CGPointMake(0, 0);
[shadow drawAtPoint:starredPoint];
UIImage* result = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
outputImage = result;
//ADDING TO UIIMAGEVIEW (PREVIEW)
preview.image = outputImage;
将照片放入 UIImageView 时,需要一些时间。这次我想显示进度视图。我怎样才能做到这一点?
编辑:我想将上面的代码放在某个方法中,然后以某种方式实现progressview,这将基于方法完成时间。但不知道。