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

ppn

macrumors member
Original poster
Oct 31, 2010
36
0
I have a Navigation View with a tab bar delegate so basically it has tab bars and a navigation bar. I'm trying to implement a "Refer a Friend" button where the user will click the button and a mail view will pop up. I'm using the MFMailComposeViewController but my navigation bar is covering the navigation bar for the mail composer so I can't click on the "Cancel" and "Send" button. I tried both self.navigationController.navigationBarHidden = YES and [[self navigationController] setNavigationBarHidden:YES animated:NO] but the navigation bar just won't go away. Anyone have suggestions for this? Do I need to send the mail controller view to the front to hide the navigation bar for my view controller?


Code:
        self.navigationController.navigationBarHidden = YES;
		MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
		[controller setToRecipients:recipient];
		[controller setSubject:subject];
		[controller setMessageBody:message isHTML:NO];
        controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
		[self presentModalViewController:controller animated:YES];
		[controller release];
 
No I didn't. The nav bar comes automatically because in my previous view, I pushviewcontroller so I didn't need to make an IBOutlet.
 
What is self in the code you supplied?

Self is a UIViewController. I basically have a TabBarController which is a UIViewController with tab bar at the bottom so I can use both a navigation controller and a tab bar. Then I have 3 different view controllers for the 3 different tabs. This code falls in one of the view controllers but I can't seem to get rid of the navigation bar.
 
Is the UINavigationController the parent of the UITabBarController or vice versa?

Also, have you verified that self.navigationController is non-nil?
 
Is the UINavigationController the parent of the UITabBarController or vice versa?

Also, have you verified that self.navigationController is non-nil?

I don't have my mac in front of me right now but my structure is like this

UIViewController (Home screen) --> UIViewController (With tab bars) --> UIViewController (with the email function).

What should I do if the self.navigationController is nil?
 
I don't have my mac in front of me right now...
I would suggest waiting to tackle this problem until it is. Troubleshooting without access to debugging is very hard.

...but my structure is like this

UIViewController (Home screen) --> UIViewController (With tab bars) --> UIViewController (with the email function).
I'm still not clear where the UITabBarController and especially the UINavigationController fits in this hierarchy.

What should I do if the self.navigationController is nil?
Well, you're not going to be able to hide the navBar if it is.

But, I don't think that is really the right approach anyways. Feels more like a band-aid to me. You should be able to present your mail composer view modally and not have to worry about its navBar being obscured. Modal views should be presented over top of any other views and not within them. So, I would try to diagnose why that's not happening for you, first.
 
Last edited:
Even I am facing the same problem .. If you find the solution please tell me how to do it.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.