1
當我的應用程序啓動時,用戶看到我的應用程序啓動時的第一個屏幕(視圖)是沒有任何導航的搜索表單。在搜索過程完成並且結果準備好顯示後,導航將顯示出來。我卡在哪裏是使其與導航控制器一起工作的正確方法。如何正確添加導航控制器到隱藏導航欄的搜索視圖
因此,假設應用程序名稱是RealEsateProperties
在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
和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.window addSubView:ListingNav.view];
[self.window makeKeyAndVisible];
return YES;
}
@end
難道我做錯了什麼?
THX幫助,
斯特凡
導航欄是否出現在第一個屏幕上?或者它根本不會出現在應用程序中? – sicKo