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

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

on

  • 1,374 views

 

Statistics

Views

Total Views
1,374
Views on SlideShare
1,368
Embed Views
6

Actions

Likes
0
Downloads
22
Comments
0

1 Embed 6

http://mj89sp3sau2k7lj1eg3k40hkeppguj6j-a-sites-opensocial.googleusercontent.com 6

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

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

  • Разработка под iOS Лекция 3Построение интерфейсов (продолжение) Контроллеры, сложные интерфейсы Глеб Тарасов
  • Сложныеконтроллеры
  • UINavigationController
  • ViewController *c = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:self.viewController];
  • - (IBAction)buttonTapped{ UIViewController *c = [[SubViewController alloc] initWithNibName:@"SubViewController" bundle:nil]; [self.navigationController pushViewController:c animated:YES];}
  • - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { self.title = @"ViewController"; } return self;}
  • UITabBarController
  • 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];
  • - (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;}
  • UIPageViewController
  • StoryBoard(демонстрация)
  • Вариантыинтерфейсов
  • http://mobile-patterns.com
  • Tabs
  • Dashboard
  • UITableView + UINavigationController Гид Покупок: Продукты
  • Widget Клуб Любителей Аудиокниг
  • Нестандартные интерфейсы News360
  • Распознавание жестов
  • UIGestureRecognizerUIView:- (void)addGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer
  • UITapGestureRecognizerUITapGestureRecognizer *t = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapped)];t.numberOfTapsRequired = 1;t.numberOfTouchesRequired = 1;[self.view addGestureRecognizer:t];
  • 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));}
  • UIPinchGestureRecognizerUIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinch:)];[self.view addGestureRecognizer:pinch]; - (void)pinch:(UIPinchGestureRecognizer *)sender { CGFloat scale = sender.scale; NSLog(@"%g", scale); }
  • UIRotationGestureRecognizerUIRotationGestureRecognizer *r = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(rotate:)];[self.view addGestureRecognizer:r]; - (void)rotate:(UIRotationGestureRecognizer *)sender { CGFloat r = sender.rotation; NSLog(@"%g", r); }
  • 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];
  • UIGestureRecognizerDelegate- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer;- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizershouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer;- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizershouldReceiveTouch:(UITouch *)touch;
  • UIGestureRecognizerStatetypedef enum { UIGestureRecognizerStatePossible, UIGestureRecognizerStateBegan, UIGestureRecognizerStateChanged, UIGestureRecognizerStateEnded, UIGestureRecognizerStateCancelled, UIGestureRecognizerStateFailed, UIGestureRecognizerStateRecognized =UIGestureRecognizerStateEnded} UIGestureRecognizerState;
  • Анимация
  • [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];
  • [UIView beginAnimations:nil context:nil];[UIView setAnimationDelegate:self];[UIView setAnimationDidStopSelector:@selector(animationFinished)];self.view.alpha = 0;[UIView commitAnimations];- (void)animationFinished{ //...}