PDA

View Full Version : iPhone SDK - How to use presentModalViewController and keep the Title Bar




maxjg
Apr 17, 2008, 06:38 PM
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



Nutter
Apr 18, 2008, 05:17 AM
I've tried giving the view controller it's own UINavigationController...


This is the right approach. Did you make sure to pass the UINavigationController itself to -presentModalViewController:animated:?

yalag
May 14, 2008, 09:40 PM
did anyone else figured this out? You cant pass UINavigationController to -presentModalViewController:animated:

maxjg
May 14, 2008, 09:42 PM
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.

yalag
May 14, 2008, 10:33 PM
maxjg how did you get around it in the end?

maxjg
May 14, 2008, 10:56 PM
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.

yalag
May 15, 2008, 12:14 AM
but if you look at the mail app, compose mail modal view clearly has it

tacoman667
May 15, 2008, 07:07 AM
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.

Nutter
May 15, 2008, 09:24 AM
Something doesn't work quite right in a beta version of a new framework. It's a bloody conspiracy...

lucasgladding
May 15, 2008, 10:51 AM
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.


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.

Farani
Sep 2, 2008, 04:44 PM
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...

sherwinzadeh
Sep 11, 2008, 11:53 AM
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.