Ø (3)Navigation
Controller in Iphone
ip7AppDelegate.h
@property
(nonatomic, retain) IBOutlet UINavigationController *navVC;
ip7AppDelegate.m
@synthesize navVC;
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self.window
makeKeyAndVisible];
self.window.rootViewController = navVC;
return YES;
}
First.h
@property (nonatomic, retain) IBOutlet UIBarButtonItem
*addBarBtn;
- (IBAction)secondViewNavButtonClicked:(id)sender;
First.m
#import "First.h"
#import "Second.h"
@synthesize addBarBtn;
- (IBAction)secondViewNavButtonClicked:(id)sender
{
Second *secVC =
[[Second alloc] initWithNibName:@"Second" bundle:nil];
[self.navigationController pushViewController:secVC animated:YES];
}
- (void)viewDidLoad
{
[super
viewDidLoad];
self.navigationItem.rightBarButtonItem = addBarBtn;
}
Second.h
@property (nonatomic, retain) IBOutlet UIBarButtonItem
*stopBarBtn;
- (IBAction)backBtnClicked:(id)sender;
Second.m
@synthesize stopBarBtn;
- (IBAction)backBtnClicked:(id)sender
{
[self.navigationController popToRootViewControllerAnimated:YES];
}
- (void)viewDidLoad
{
[super
viewDidLoad];
self.title =
@"Second";
self.navigationItem.rightBarButtonItem = stopBarBtn;
}
No comments:
Post a Comment