开发者

How to properly add a Navigation Controller to my Search View with hidden Navigation Bar

When my app is launched the first screen (view) the user sees when my app is launched is a search form without any navigation. Navigation will show up after search process is done and results are ready to be displayed. Where I'm stuck at is the proper way to make it work with the navigation controller.

So, assuming the app name is RealEsateProperties

In RealEsatePropertiesAppDelegate.h:

#import <UIKit/UIKit.h>

@class RealEsatePropertiesViewController;

@interface RealEsatePropertiesAppDelegate : NSObject <UIApplicationDelegate> 
{
        UINavigationController *ListingNav;
}

@property (nonatomic, retain) IBOutlet UIWindow window;

@property (nonatomic, retain) RealEsatePropertiesViewController *viewController;

// Then I added this line for the navigation
@property (nonatomic, retain) UINavigationController *ListingNav;


@end

and in RealEsatePropertiesAppDelegate.m:

#import "RealEsatePropertiesAppDelegate.h"
#import "RealEsatePropertiesViewController.h"

@synthesize window=_window;

@synthesize window=_viewController;

@synthesize ListingNav;

@implementation RealEsatePropertiesAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLanchingWithOptions:(NSDictionary *)launchOptions 
{

self.window.rootViewController = self.viewController;

// Iadded the following 4 lines to try making the navigation thing work without showing any navigation bar on the first screen (that is the search form)
self.ListingNav = [[UINavigationController alloc] initWithRootController:self.viewController];
self.ListingNav.navigationBarHidden = YES;
[self.win开发者_Python百科dow addSubView:ListingNav.view];

[self.window makeKeyAndVisible];
return YES;
}

@end

Am I doing anything wrong ?

Thx for helping,

Stephane


You need to create/alloc your RealEsatePropertiesViewController ?

viewController = [[RealEsatePropertiesViewController alloc] init];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜