CocoaHeads Rennes #4 : la rotation sur iOS

1,033 views

Published on

Published in: Technology, Business, Real Estate
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,033
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
14
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

CocoaHeads Rennes #4 : la rotation sur iOS

  1. 1. CocoaHeads Rennes 13 octobre 2011 Thomas Dupont La r tation sur iOS
  2. 2. Comment supporter les orientations ?
  3. 3. Project
  4. 4. UIViewController- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation{ return UIInterfaceOrientationIsLandscape(orientation);}
  5. 5. Comment gérer la rotation ?
  6. 6. UIView @property (nonatomic) UIViewAutoresizing autoresizingMaskenum { UIViewAutoresizingNone, UIViewAutoresizingFlexibleLeftMargin, UIViewAutoresizingFlexibleWidth, UIViewAutoresizingFlexibleRightMargin, UIViewAutoresizingFlexibleTopMargin, UIViewAutoresizingFlexibleHeight, UIViewAutoresizingFlexibleBottomMargin};
  7. 7. UIViewAutoresizing[myView setAutoresizingMask:(UIViewAutoresizingFlexibleLeftMargin| UIViewAutoresizingFlexibleTopMargin| UIViewAutoresizingFlexibleRightMargin| UIViewAutoresizingFlexibleBottomMargin)];
  8. 8. UIViewAutoresizing[myView setAutoresizingMask:(UIViewAutoresizingFlexibleLeftMargin| UIViewAutoresizingFlexibleBottomMargin)];
  9. 9. UIViewAutoresizing[myView setAutoresizingMask:(UIViewAutoresizingFlexibleWidth| UIViewAutoresizingFlexibleTopMargin| UIViewAutoresizingFlexibleBottomMargin)];
  10. 10. UIViewController- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration - (void)didRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration
  11. 11. Comment être prévenu des rotations ?
  12. 12. UIWindow makeKeyAndVisibleUIWindowLevelNormal UIWindowLevelAlertUIWindowLevelStatusBar
  13. 13. UIViewControllerUIWindow UIView UIViewController UIView UIViewController @property (nonatomic, retain) UIViewController *rootViewController
  14. 14. Démo
  15. 15. Comment gérer manuellement la rotation d’une UIView ?
  16. 16. connaître l’orientation @property (nonatomic) UIInterfaceOrientation statusBarOrientation @property (nonatomic, readonly) UIDeviceOrientation orientationtypedef enum { UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait, UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown, UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight, UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft} UIInterfaceOrientation;typedef enum { UIDeviceOrientationUnknown, UIDeviceOrientationPortrait, UIDeviceOrientationPortraitUpsideDown, UIDeviceOrientationLandscapeLeft, UIDeviceOrientationLandscapeRight, UIDeviceOrientationFaceUp, UIDeviceOrientationFaceDown} UIDeviceOrientation;
  17. 17. UIWindow width(0, 0) height
  18. 18. UIWindow heightwidth (0, 0)
  19. 19. changement d’orientationUIApplicationWillChangeStatusBarOrientationNotificationUIApplicationDidChangeStatusBarOrientationNotification statusBarOrientationAnimationDuration
  20. 20. Démo
  21. 21. Merci

×