2011년 5월 19일 목요일

iphone 네비게이션바 제어하기

//
//  SampleDay4_2AppDelegate.m
//  SampleDay4-2
//
//  Created by bit on 11. 5. 19..
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "SampleDay4_2AppDelegate.h"

@implementation SampleDay4_2AppDelegate

@synthesize window;
@synthesize mNavi;


#pragma mark -
#pragma mark Application lifecycle

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    
    // Override point for customization after application launch.

    self.window.rootViewController = self.mNavi;
//[self.mNavi setNavigationBarHidden:YES]; 
    [self.window makeKeyAndVisible];
    
    return YES;
}




//
//  FirstView.m
//  SampleDay4-2
//
//  Created by bit on 11. 5. 19..
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "FirstView.h"
#import "SecondView.h"


@implementation FirstView

// The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
/*
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization.
    }
    return self;
}
*/


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
self.title = @"First";
}


/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations.
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc. that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}

-(IBAction)onClickNext:(id)sender
{
SecondView *view = [[SecondView alloc] initWithNibName:@"SecondView" bundle:nil];
[self.navigationController pushViewController:view animated:YES];
[view release];
}


@end



//
//  SecondView.m
//  SampleDay4-2
//
//  Created by bit on 11. 5. 19..
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//



-(IBAction)onClickBack:(id)sender
{
[self.navigationController popViewControllerAnimated:YES];
}

댓글 없음:

댓글 쓰기

참고: 블로그의 회원만 댓글을 작성할 수 있습니다.