拍照后如何展示UIView?

时间:2013-01-09 15:34:26

标签: ios uiview addsubview

我需要在拍照后显示UIView(UIView显示加载消息)。

每次我需要显示加载消息时,我都使用了这段代码:

NSArray* loading = [[NSBundle mainBundle] loadNibNamed:@"LoadingViewController"
                                                     owner:self
                                                   options:nil];

self.loadingView = [ loading objectAtIndex: 0];

[self.view addSubview:self.loadingView];
[self.view bringSubviewToFront:self.loadingView];
self.loadingView is the loading UIView.

我需要在按下“完成”按钮后显示UIView loadingView(拍照后),我试试这个:

- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    NSArray* loading = [[NSBundle mainBundle] loadNibNamed:@"LoadingViewController"
                                                     owner:self
                                                   options:nil];

    self.loadingView = [ loading objectAtIndex: 0];

    [picker.navigationBar addSubview:self.loadingView];
    [picker.navigationBar bringSubviewToFront:self.loadingView];
    /*image processing*/
}

但是不行。我也尝试改变:

[picker.navigationBar addSubview:self.loadingView];
[picker.navigationBar bringSubviewToFront:self.loadingView];

[picker.view addSubview:self.loadingView];
[picker.view bringSubviewToFront:self.loadingView];

1 个答案:

答案 0 :(得分:1)

首先,我建议您使用库加载UIView,如SVProgressHUD

此外,您需要使用线程来执行您要执行的操作,请查看this link