在我的应用程序中,在使用 uiimagepicker 选择图像后,它会通过网络服务进行处理。 Web 处理需要一秒钟,所以我想创建一个带有事件指示器 View 的灰色叠加层。
我的问题是,在处理完成之前,UIImagePickerView View 似乎停留在所有内容之上。
我已经尝试使用 [myPicker dismissModalViewControllerAnimated:YES];
在加载叠加层或处理甚至开始之前,但 View 仍在屏幕上。之后,我的覆盖加载如下
ovController = [[OverlayViewController alloc] initWithNibName:@"OverlayViewController" bundle:[NSBundle mainBundle]];
CGFloat yaxis = self.navigationController.navigationBar.frame.size.height;
CGFloat width = self.view.frame.size.width;
CGFloat height = self.view.frame.size.height;
CGRect frame = CGRectMake(0, yaxis, width, height);
ovController.view.frame = frame;
ovController.view.backgroundColor = [UIColor grayColor];
ovController.view.alpha = 0.7;
[self.view insertSubview:ovController.view aboveSubview:self.view];
在关闭 myPicker 之前,我也尝试过使用 [[myPicker cameraOverlayView] insertSubview:ovController.view];
,但无济于事。
需要说明的是,我试图在 UIImagePicker 消失后但在 Web 处理开始之前在屏幕上显示“正在加载”叠加层。
任何输入将不胜感激。谢谢
最佳答案
听起来您正在主线程上进行上传,这会锁定 View 以防止更新。您可以尝试在单独的线程上进行上传,以便主线程可以关闭图像选择器并显示叠加层。
关于iphone - UIImagePicker 和覆盖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6162987/