Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

amagic84

macrumors newbie
Original poster
Apr 29, 2011
7
0
Hi,

I'm calling presentModalViewController:animated: to show UIImagePickerController from my UITabBarController and I'm seeing a weird problem. UIImagePickerController takes the whole screen but then around top 20 px (looks about the same area where the status bar resides) is overlapped with the bottom portion of what appears to be the bottom of a blue navigation bar. I can only see the bottom of the bar text but I think it says "Root View Controller". Now I have UINavigationControllers in my project but none of them are named that.

Any thoughts or ideas on how to fix this? Any help is much appreciated.
Thanks!

amagic
 

amagic84

macrumors newbie
Original poster
Apr 29, 2011
7
0
screenshot

Sure, here's a screenshot: http://img543.imageshack.us/img543/2256/photohc.png

Here's how I invoke presentation image picker:
Code:
imagePickerController = [[UIImagePickerController alloc] init];
    
imagePickerController.delegate = self;
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;

NSLog(@"View: %@", imagePickerController.view);

[appDelegate.navController.topViewController.tabBarController presentModalViewController:imagePickerController animated:YES];

NSLog(@"View: %@", imagePickerController.view);

I should also explain that that I have several layers of controllers in my app. The ui navigation controller is used to push around the main views (login, tutorial, and main view). The main view is controlled by a ui tab bar controller.

Now I realized last night after further testing that the view frame of ImagePicker is being changed after i call presentModalViewController. Before presentModalViewController the frame is (0, 0, 320, 480) then right after its set to (0, -20, 320, 480) which is probably the cause of this whole issue. Now, I've tried hiding and showing the status bar both before and after presenting imagePicker but to no avail.

I know its probably some simple issue but its been bugging me...
 

amagic84

macrumors newbie
Original poster
Apr 29, 2011
7
0
One more thing, when I use one of my own view controllers in place of the image picker everything works correctly. Instead of the blue bar I see a status bar, as it should be.
 

amagic84

macrumors newbie
Original poster
Apr 29, 2011
7
0
I am not explicitly setting an overlay, I'll have to check when I get home. The thing is, none of my nav bars are blue or have that title.
 

Shawnpk

macrumors 6502
Jan 13, 2011
350
0
Los Angeles, CA
It looks like your modalViewController is sitting behind the rootViewController. The rootViewController is usually the first view shown on the screen, which in this case looks like a navigation controller.
 

amagic84

macrumors newbie
Original poster
Apr 29, 2011
7
0
Shawnpk, you're totally right! But now I don't understand how to fix it. My root view controller is a navigation controller with a hidden navigation bar. So I do not know why I'm seeing part of that bar over the modalViewController.

Any hints on how to fix it?
 

amagic84

macrumors newbie
Original poster
Apr 29, 2011
7
0
Turns out my root view controller (UINavigationController) is overlapping the modalViewController (image picker). Any ideas on how to fix this?
 

amagic84

macrumors newbie
Original poster
Apr 29, 2011
7
0
No, it wasn't. But the weirdest thing happened last night - the issue fixed itself.
Here's what I did:
I messed around with my code trying to present imagePicker with all of my different view controllers. I somehow got my code into an unusable state (the app would no longer start up) so I ended up erasing the app from my phone and reverting to the last snapshot of the code. Now that snapshot still had the problem as far as I knew. But then when I built the code and ran it on my iPhone the problem was no longer occurring. ImagePicker was covering up the whole screen all of a sudden. I'm no longer able to reproduce the problem, even with the code I posted.

So I'm happy its fixed but I'm bummed about now knowing how or why.

Thanks for all your help!
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
Xcode definitely has a problem with deleting old resource files. We've all run into a case of weirdness that was fixed by a clean and rebuild.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.