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
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;
}
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;
}
相关文章推荐
- Learn how to Use UIPageViewController in iOS
- How to use Spring @Component, @Repository, @Service and @Controller Annotations?
- Core Data on iOS 5 Tutorial: How To Use NSFetchedResultsController
- UINavigationBar:How to add background image with UINavigationController?
- Applications Programming in Smalltalk-80(TM):How to use Model-View-Controller (MVC)
- How can you decide to use UINavigationBar, UIToolbar and UITabbar
- ABAP---How to use controls
- How to use bonding to increase the throughput?
- How to use ntrights.exe tool to assign user right in windows server env
- WHAT IS ISO? A CAMERA’S SENSITIVITY TO LIGHT EXPLAINED, AND HOW TO USE IT
- How To Use Ip Command In Linux with Examples
- How to use mouse to moving windows of not have title bar?
- How to use String Resources
- How can use window.showModalDialog to open a .aspx page pop up window.
- Dalvik VM Hash - how to use
- Lesson6 how to use HTML QT Widgets
- How to use svn in Linux
- How To Choose and Use Strong Passwords
- How to use a 32bit Oracle11_g client in 64 win system and not conflict with sqldeveloper 64 bit tool
- How To Use the ODBC .NET Managed Provider in Visual C# .NET and Connection Strings