您應該將UIActivityIndicatorView添加到視圖層次結構的頂部,否則它將被UIPickerViewController取消,除非您在調整大小操作之後使用回調,並在回調中關閉了UIImagePickerController。
或者您可以使用像SVProgressHUD這樣的進度HUD。
希望這有助於=)
我們做了一個小小的聊天會話,解決這樣:
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
dispatch_async(dispatch_get_main_queue(), ^{
UIView *primaryImage = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,460)];
primaryImage.backgroundColor = [UIColor redColor];
primaryImage.alpha =0.9;
UIView *secondaryImage = [[UIView alloc] initWithFrame:CGRectMake(0,0,70,70)];
secondaryImage.center = CGPointMake(160, 240);
secondaryImage.backgroundColor = [UIColor blackColor];
secondaryImage.alpha = 0.9;
secondaryImage.layer.cornerRadius = 12;
[primaryImage addSubview:secondaryImage];
UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 25, 25)];
indicator.center = CGPointMake(35, 35);
[indicator setHidesWhenStopped:NO];
[secondaryImage addSubview:indicator];
[indicator startAnimating];
[indicator release];
[secondaryImage release];
[picker.view addSubview:primaryImage];
[primaryImage release];
});
// Put here the code to resize the image
dispatch_async(dispatch_get_main_queue(), ^{
// Dismiss the picker controller
});
});
是的,我把它在視圖層次結構的頂部,但它並沒有顯示出來,直到解散動畫時期。這就是我的意思是「它將被UIPickerViewController解散」。 –
對於「在視圖層次結構的頂部」,我的意思是在UIWindow中。無論如何,你可以嘗試添加UIIndicatorView,當你創建UIPickerController並用一個ivar控制它。 – GreyHands
你的意思是添加到窗口?讓我試試,還是不行。是的,我已經創建了一個指標並將其隱藏起來,但是一旦將隱藏設置爲NO,它就不起作用。 –