Guest User

Untitled

a guest
Dec 10th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
  2.  
  3. {
  4.     if (UIInterfaceOrientationIsLandscape(interfaceOrientation))
  5.        
  6.     {
  7.             NSLog(@"landscape");
  8.         self.scrollView.contentSize = CGSizeMake(480,713);
  9.  
  10.     }
  11.     else
  12.     {
  13.         NSLog(@"portrait");
  14.         self.scrollView.contentSize = CGSizeMake( 320, 713);
  15.  
  16.  
  17.     }
  18. }
  19.  
  20. // Override to allow orientations other than the default portrait orientation.
  21. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  22.     // Return YES for supported orientations.
  23.     NSLog(@"caleld");
  24.  
  25.     if (interfaceOrientation==UIInterfaceOrientationLandscapeLeft || interfaceOrientation==UIInterfaceOrientationLandscapeRight) {
  26.        
  27.         if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
  28.         {
  29.             scrollView.frame = CGRectMake(0, 0,1024,600);
  30.             self.scrollView.contentSize = CGSizeMake(1024, 768);
  31.        
  32.         }
  33.         else {
  34.         scrollView.frame = CGRectMake(0, 0, 480, 300);
  35.         self.scrollView.contentSize = CGSizeMake(480,713);
  36.             NSLog(@"contens size frame width %f ,%f",self.scrollView.contentSize.width,self.scrollView.contentSize.height);
  37.         }
  38.        
  39.     }
  40.    
  41.     else {
  42.     if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
  43.     {
  44.         scrollView.frame = CGRectMake(0, 0, 768, 800);
  45.         self.scrollView.contentSize = CGSizeMake(768, 1024);
  46.     }
  47.    
  48.     else
  49.     {
  50.         scrollView.frame = CGRectMake(0, 0, 320, 460);
  51.         self.scrollView.contentSize = CGSizeMake( 320, 713);
  52.            NSLog(@"contens size frame width %f ,%f",self.scrollView.contentSize.width,self.scrollView.contentSize.height);
  53.     }
  54.        
  55.     }
  56.     return YES;
  57.    
  58. }
Add Comment
Please, Sign In to add comment