2013년 4월 13일 토요일

UINavigationController 기반의 어플리케이션 만들기

View base application 프로젝트 생성한후에 application delegate에 다음과 같은 코드만 추가해 줌으로써 간단히 navigationcontroller 기반 어플리케이션으로 변환 된다.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
    UINavigationController* naviController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
    [naviController setNavigationBarHidden:YES];   //sub viewcontroller에서 이부분을 NO로 설정해 주면 뒤로가기가 가능하도록 navigation bar가 보임.
    self.window.rootViewController = naviController;
    [self.window makeKeyAndVisible];
    [self.viewController release];
    return YES;
}

댓글 없음:

댓글 쓰기