Разработка под iOS              Лекция 3Построение интерфейсов    (продолжение) Контроллеры, сложные интерфейсы           ...
Сложныеконтроллеры
UINavigationController
ViewController *c = [[ViewController alloc]                             initWithNibName:@"ViewController"                 ...
- (IBAction)buttonTapped{    UIViewController *c =          [[SubViewController alloc]               initWithNibName:@"Sub...
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{    self = [super initWithNibName:nibName...
UITabBarController
ViewController *c = [[ViewController alloc]                          initWithNibName:@"ViewController"                    ...
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{    self = [super initWithNibName:nibName...
UIPageViewController
StoryBoard(демонстрация)
Вариантыинтерфейсов
http://mobile-patterns.com
Tabs
Dashboard
UITableView + UINavigationController                   Гид Покупок: Продукты
Widget Клуб Любителей Аудиокниг
Нестандартные интерфейсы                       News360
Распознавание жестов
UIGestureRecognizerUIView:- (void)addGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer
UITapGestureRecognizerUITapGestureRecognizer *t = [[UITapGestureRecognizer alloc]                             initWithTarg...
UIPanGestureRecognizerUIPanGestureRecognizer *p = [[UIPanGestureRecognizer alloc]                                   initWi...
UIPinchGestureRecognizerUIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc]                               ...
UIRotationGestureRecognizerUIRotationGestureRecognizer *r = [[UIRotationGestureRecognizer alloc]                          ...
UISwipeGestureRecognizer *s = [[UISwipeGestureRecognizer alloc]                                     initWithTarget:self   ...
UIGestureRecognizerDelegate- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer;- (BOOL)gestureRe...
UIGestureRecognizerStatetypedef enum {    UIGestureRecognizerStatePossible,    UIGestureRecognizerStateBegan,    UIGesture...
Анимация
[UIView beginAnimations:nil context:nil];[UIView setAnimationDuration:0.5];self.view.frame = CGRectMake(100, 100, 50, 50);...
[UIView beginAnimations:nil context:nil];[UIView setAnimationDelegate:self];[UIView setAnimationDidStopSelector:@selector(...
Курсы по мобильной разработке. 3 лекция. Сложные интерфейсы.
Курсы по мобильной разработке. 3 лекция. Сложные интерфейсы.
Курсы по мобильной разработке. 3 лекция. Сложные интерфейсы.
Курсы по мобильной разработке. 3 лекция. Сложные интерфейсы.
Upcoming SlideShare
Loading in …5
×

Курсы по мобильной разработке. 3 лекция. Сложные интерфейсы.

1,354 views
1,216 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,354
On SlideShare
0
From Embeds
0
Number of Embeds
13
Actions
Shares
0
Downloads
24
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Курсы по мобильной разработке. 3 лекция. Сложные интерфейсы.

  1. 1. Разработка под iOS Лекция 3Построение интерфейсов (продолжение) Контроллеры, сложные интерфейсы Глеб Тарасов
  2. 2. Сложныеконтроллеры
  3. 3. UINavigationController
  4. 4. ViewController *c = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:self.viewController];
  5. 5. - (IBAction)buttonTapped{ UIViewController *c = [[SubViewController alloc] initWithNibName:@"SubViewController" bundle:nil]; [self.navigationController pushViewController:c animated:YES];}
  6. 6. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { self.title = @"ViewController"; } return self;}
  7. 7. UITabBarController
  8. 8. ViewController *c = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];SubViewController *s = [[SubViewController alloc] initWithNibName:@"SubViewController" bundle:nil];UITabBarController *tc = [[UITabBarController alloc] init];tc.viewControllers = [NSArray arrayWithObjects:c, s, nil];
  9. 9. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { self.title = @"ViewController"; self.tabBarItem.image = [UIImage imageNamed:@"1.png"]; } return self;}
  10. 10. UIPageViewController
  11. 11. StoryBoard(демонстрация)
  12. 12. Вариантыинтерфейсов
  13. 13. http://mobile-patterns.com
  14. 14. Tabs
  15. 15. Dashboard
  16. 16. UITableView + UINavigationController Гид Покупок: Продукты
  17. 17. Widget Клуб Любителей Аудиокниг
  18. 18. Нестандартные интерфейсы News360
  19. 19. Распознавание жестов
  20. 20. UIGestureRecognizerUIView:- (void)addGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer
  21. 21. UITapGestureRecognizerUITapGestureRecognizer *t = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapped)];t.numberOfTapsRequired = 1;t.numberOfTouchesRequired = 1;[self.view addGestureRecognizer:t];
  22. 22. UIPanGestureRecognizerUIPanGestureRecognizer *p = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)];[self.view addGestureRecognizer:p];- (void)pan:(UIPanGestureRecognizer *)sender{ CGPoint t = [sender translationInView:self.view]; CGPoint v = [sender velocityInView:self.view]; NSLog(@"%@", NSStringFromCGPoint(t)); NSLog(@"%@", NSStringFromCGPoint(v));}
  23. 23. UIPinchGestureRecognizerUIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinch:)];[self.view addGestureRecognizer:pinch]; - (void)pinch:(UIPinchGestureRecognizer *)sender { CGFloat scale = sender.scale; NSLog(@"%g", scale); }
  24. 24. UIRotationGestureRecognizerUIRotationGestureRecognizer *r = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(rotate:)];[self.view addGestureRecognizer:r]; - (void)rotate:(UIRotationGestureRecognizer *)sender { CGFloat r = sender.rotation; NSLog(@"%g", r); }
  25. 25. UISwipeGestureRecognizer *s = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)]; s.direction = UISwipeGestureRecognizerDirectionLeft; [self.view addGestureRecognizer:s];• UISwipeGestureRecognizer• UILongPressGestureRecognizerUILongPressGestureRecognizer *p = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)];p.minimumPressDuration = 0.5;[self.view addGestureRecognizer:p];
  26. 26. UIGestureRecognizerDelegate- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer;- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizershouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer;- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizershouldReceiveTouch:(UITouch *)touch;
  27. 27. UIGestureRecognizerStatetypedef enum { UIGestureRecognizerStatePossible, UIGestureRecognizerStateBegan, UIGestureRecognizerStateChanged, UIGestureRecognizerStateEnded, UIGestureRecognizerStateCancelled, UIGestureRecognizerStateFailed, UIGestureRecognizerStateRecognized =UIGestureRecognizerStateEnded} UIGestureRecognizerState;
  28. 28. Анимация
  29. 29. [UIView beginAnimations:nil context:nil];[UIView setAnimationDuration:0.5];self.view.frame = CGRectMake(100, 100, 50, 50);[UIView commitAnimations];[UIView beginAnimations:nil context:nil];self.view.alpha = 0;[UIView commitAnimations];
  30. 30. [UIView beginAnimations:nil context:nil];[UIView setAnimationDelegate:self];[UIView setAnimationDidStopSelector:@selector(animationFinished)];self.view.alpha = 0;[UIView commitAnimations];- (void)animationFinished{ //...}

×