Интуит. Разработка приложений для iOS. Лекция 4. Controllers

  • Published on
    02-Dec-2014

  • View
    413

  • Download
    6

DESCRIPTION

 

Transcript

  • 1. Controllers iOS 4 gleb34@gmail.com
  • 2.
  • 3. UIView ?
  • 4. UIView ? view.frame = CGRectMake()
  • 5. UIView ?
  • 6. UIView ? - view addSubview:
  • 7. UIButton?
  • 8. UIButton? [button addTarget:self action:@selector(method) forControlEvents:UIControlEventTouchUpInside];
  • 9. UIViewController ?
  • 10. UIViewController ? viewDidLoad
  • 11.
  • 12. UINavigationController
  • 13. ViewController *c = [[ViewController alloc] init]; ! UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:c]; ! self.window.rootViewController = nc;
  • 14. - (void)buttonTapped { MyViewController *my = [[MyViewController alloc] init]; [self.navigationController pushViewController:my animated:YES]; } - (void)backTapped { [self.navigationController popViewControllerAnimated:YES]; }
  • 15. UITabBarController
  • 16. FirstViewController *vc1 = [[FirstViewController alloc] init]; SecondViewController *vc2 = [[SecondViewController alloc] init]; ThirdViewController *vc3 = [[ThirdViewController alloc] init]; ForthViewController *vc4 = [[ForthViewController alloc] init]; ! UITabBarController *t = [[UITabBarController alloc] init]; t.viewControllers = @[ vc1, vc2, vc3, vc4 ]; self.window.rootViewController = t;
  • 17. Modal Controller
  • 18. - (void)buttonTapped { DataViewController *vc = [[DataViewController alloc] init]; [self presentViewController:vc animated:YES completion:nil]; } - (void)backTapped { [self dismissViewControllerAnimated:YES completion:nil]; }
  • 19. UIPopoverController
  • 20. - (void)showPopover { UIViewController *vc = [[UIViewController alloc] init]; vc.view.frame = CGRectMake(0, 0, 100, 200); UIPopoverController *p = [[UIPopoverController alloc] initWithContentViewController:vc]; [p presentPopoverFromRect:self.button.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES]; self.popover = p; }
  • 21. UISplitViewController
  • 22. UIPageViewController
  • 23. !
  • 24. -
  • 25. ! gleb34@gmail.com twitter.com/pilot34

Recommended

View more >