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

maxjg

macrumors member
Original poster
Aug 6, 2006
92
0
Hello guys,
Been messing with this one for a while, still haven't been able to figure it out. I'm trying to use presentModalViewController, and can get it to mainly work, but I need to keep the title bar. I have, so far, been unable to do so. I've tried giving the view controller it's own UINavigationController, and still, no luck.
Any ideas?

Max
 
did anyone else figured this out? You cant pass UINavigationController to -presentModalViewController:animated:
 
did anyone else figured this out? You cant pass UINavigationController to -presentModalViewController:animated:

Think I saw somewhere that Apple's not allowing you to do this in the beta, or something to the same effect.
 
maxjg how did you get around it in the end?

Never did. Even in Apple's examples for the SDK, where, in real contexts, they would use presentModalViewController, they instead use pushViewController. I guess we'll just have to deal with it(or hack our way around it). If I make any sudden discoveries, I'll post them here.
 
but if you look at the mail app, compose mail modal view clearly has it

What current apple-created applications are doing and what they are "allowing" us to do through the supplied SDK are two completely different things. They are putting a double standard on us so that they can keep the illusion of security in one of their now-landmark products. If you want to circumvent the SDK and do whatever you wish then you will need to look into unlocking and jailbreaking your phone. Then you will be able to have full access to any and all object frameworks available on the phone itself. This will have no official support and documentation of course unless some users of this method decide to produce it for you.
 
did anyone else figured this out? You cant pass UINavigationController to -presentModalViewController:animated:

You definitely can pass a navigation controller to presentModalViewController:animated:. Below is the sample code from one of my apps (using UIViewController instead of my class name). Make sure your view controller is a subclass of UIViewController and the method should take it.

Code:
if (navigationController == nil) 
{
	if (rootViewController == nil)
	{
		rootViewController = [[UIViewController alloc] init];
	}
	navigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
}
[[self navigationController] presentModalViewController:navigationController animated:YES];

BTW: this is called from a view controller that is already on another navigation controller.
 
Has this issue been resolved for you guys? I was struggling with this for an hour or two and then I looked at the BonjourWeb example from the Apple Dev Center and I figured it out. If people want me to, I'll post up some code once it get it 100% working...
 
Has this issue been resolved for you guys? I was struggling with this for an hour or two and then I looked at the BonjourWeb example from the Apple Dev Center and I figured it out. If people want me to, I'll post up some code once it get it 100% working...

If you can post a sample that would be great. I also wasted a couple hours on this. Most of the problem is poor documentation and not enough samples code so the support from this forum is really beneficial.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.