开发者

UIImagePickerController source (Camera) when dismissed inside a UITabBarController shows blank screen

I have the following hierarchy in my application:

UINavigationController 
     |__ UITabBarController
             |__ UINavigationController
                     |__ ViewProfilePhotoController (*presentModalViewController:picker is done here)

The problem I have is when I press cancel and dismiss my UIImagePickerController in the ViewProfilePhotoController I get a blank screen with status bar only and not the view that is suppose to show inside the ViewProfilePhotoController (The actual photo).

This behaviour is really strange, because I have tried the same code by taking out the UITabBarController from my application hierarchy and this problem is not present, and everything works as expected. Believe me all the delegates are properly configured in the ViewProfilePhotoController and I have tried to fix it for hours.

I have also check ALL possible configurations within UIImagePickerController, by setting开发者_Python百科 the RIGHT parent view, and nothing has worked so far.

I have also tried to properly cascade - viewWillAppear - viewWillDisappear down the hierarchy and still no luck.

Any insight will be greatly appreciate it . Thanx


OK so for the record after many many hours I found the solution.

In my rootController UINavigationController I was adding 2 UIViewControllers to the navigation stack and then after the authentication happened I did the following to add my UITabBarController:

[self.navigationController initWithRootViewController:theTabController];

I was adding the UITabController as the rootViewController in the second UIViewController and the UIImagePickerController doesn't like this, and when is added subsequently later on in the navigation. It will be dismissed leaving a white screen.

So instead. I called the root UIViewController of my stack though my appDelegate and added the UITabBarController like this :

- (void) authSucceded {

       [self createTabBarController];

       self.theTabController.view.tag = 2345;
       [self.view addSubview:self.theTabController.view];
}

Voila this is my solution....

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜