您的位置:首页 > 产品设计 > UI/UE

How to use UINavigationController

2012-05-20 23:32 169 查看
Adding a navigationController by code, and add UINavigationBarItem on both left and right hand sides.

FirstViewControllerDelegate.h

#import <UIKit/UIKit.h>
#import "XDreamViewControllerViewController.h"
@interface XDreamAppDelegate : UIResponder <UIApplicationDelegate>

@property (strong,nonatomic) UIWindow *window;

@property (strong,nonatomic) XDreamViewControllerViewController *viewController;

@end

FirstViewControllerDelegate.m

#import "XDreamAppDelegate.h"
@implementation XDreamAppDelegate
@synthesize window = _window;
@synthesize viewController=_viewController;

- (BOOL)application:(UIApplication *)applicationdidFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindowalloc] initWithFrame:[[UIScreenmainScreen] bounds]];
// Overridepoint for customization after application launch.
self.window.backgroundColor = [UIColorwhiteColor];
self.viewController=[[XDreamViewControllerViewControlleralloc] initWithNibName:@"Main"bundle:nil];
UINavigationController*navigationController=[[UINavigationControlleralloc] initWithRootViewController:self.viewController];
self.window.rootViewController=navigationController;
[self.windowmakeKeyAndVisible];
return YES;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息