PDA&Mobile2010.02.01 11:03
* 본 포스트는 Blog.MissFlash.com에서 작성한 것으로, 원문 저작자의 동의없이 마음대로 퍼가실 수 없습니다. 포스트의 내용이 마음에 드시면 링크를 이용해주시면 감사하겠습니다.

> Stanford Lecture #7

* Push to add a view controller
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated;

* Pop to remove a view controller
- (void)popViewControllerAnimated:(BOOL)animated;

* Pushing your first view controller
- (void)applicationDidFinishLaunching:(UIApplication *)application {
navController = [[UINavigationController alloc] init];
[navController pushViewController:firstViewController animated:NO];
[window addSubview:navController.view];
}

* Push from within a view controller on the desk
- (void)myAction:(id)sender{
UIViewController *viewController = ...;
[self.navigationController pushViewController:viewController animated:YES];
}

* Text bar button item
- (void)viewDidLoad{
UIBarButtonItem *fooButton = [[UIBarButtonItem alloc] initWithTitle:@"Foo" style:UIBarButtonItemStyleBordered target:self action:@selector(foo:)];
self.navigationItem.leftBarButtonItem = fooButton;
[fooButton release];
}

* System bar button item
- (void)viewDidLoad{
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd style:UIBarButtonItemStyleBordered target:self action:@selector(add:)];
self.navigationItem.rightBarButtonItem = addButton;
[addButton release];
}

* Edit/Done button
self.navigationItem.leftBarButtonItem = self.editButtonItem;
- (void)setEditing:(BOOL)editing animated:(BOOL)animated{
// Update appearance of views
}

* Custom title view
UISegmentedControl *segmentedControl = ...;
self.navigationItem.titleView = segmentedControl;
[segmentedControl release];

* Back button
self.title = @"Hello there, CS193P!";
UIBarButtonItem *heyButton = [[UIBarButtonItem alloc] initWithTitle:@"Hey!" ...];
self.navigationItem.backButtonItem = heyButton;
[heyButton release];
vs.

* Setting up a Tab Bar controller
- (void)applicationDidFinishLaunching:(UIApplication *)application {
tabBarController = [[UITabBarController alloc] init];
tabBarController.viewControllers = myViewControllers;
[window addSubview:tabBarController.view];
}

* Creating Tab Bar items : Title and image
- (void)viewDidLoad{
self.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Playlists" image:[UIImage imageNamed:@"music.png"] tag:0];
}

* Creating Tab Bar items : System item
- (void)viewDidLoad{
self.tabBarItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemBookmarks tag:0];
}

* Nesting Navigation Controllers
- Create a Tab Bar controller
tabBarController = [[UITabBarController alloc] init];

- Create each Navigation controller
navController = [[UINavigationController alloc] init];
[navController pushViewController:firstViewController animated:NO];

- Add them to the Tab Bar controller
tabBarController.viewControllers = [NSArray arrayWithObjects:navController, anotherNavController, someViewController, nil];
저작자 표시 비영리 변경 금지
신고

이 글은 새로운 정보가 추가될 때마다 업데이트됩니다. 추천으로 아래 숫자에 1을 더해보세요. :)
RSS구독을 하시면 포스트를 배달해 드립니다. ▷ 한RSS 구독하기, 구글리더 구독하기

댓글을 달아 주세요


티스토리 툴바