Guest User

Untitled

a guest
Aug 18th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. iOS interface orientation always says portrait
  2. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
  3. {
  4. // Overriden to allow any orientation.
  5. return YES;
  6. }
  7.  
  8. - (void)setArticleRenderView:(UIView *)view
  9. {
  10. CGRect frame;
  11.  
  12. if(self.interfaceOrientation == UIInterfaceOrientationPortrait)
  13. {
  14. NSLog(@"Iam in portrait");
  15. }
  16.  
  17. if(UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]))
  18. {
  19. NSLog(@"Portrait");
  20. }
  21.  
  22. if(UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]))
  23. frame = CGRectMake(0, 44, 768, 960);
  24. else
  25. frame = CGRectMake(0, 44, 703, 704);
  26.  
  27. view.frame = frame;
  28.  
  29. [self.view addSubview:view];
  30.  
  31. NSLog(@"%f x %f", view.frame.size.width, view.frame.size.height);
  32. NSLog(@"%f x %f", view.frame.origin.x, view.frame.origin.y);
  33. }
Add Comment
Please, Sign In to add comment