title: moving UIScrollView on rotate on the ipad
body: <p>I have a multiview application and i have built a custom panelview controller to display panels with limited information about a product, the problem is that there should be 3 panels in portrait aspect and 4 in landscape.</p>
  
  <p>Due to the depth of view controllers (about 5) the <code>didRotateFromInterfaceOrientation:</code> event will not trigger on the child viewcontroller so i am using the <code>NSNotificationCenter</code> on the rootViewController to post a message and picking it up with the child controller.</p>
  
  <p>I can move the panels (UIScrollViews) without trouble but they move into place when i want them to but they move instantly which isn't smooth or tidy, i want them to slide into their new location.</p>
  
  <p>After some searching i am still having no luck finding out how to do this.</p>
  
  <pre><code>-(void) updatePanelLocations{
      int buttonWidth = 230;
      int buttonHeight = 335;
      float frameWidth = mainPanel.frame.size.width;
      int numberOfcolumns = frameWidth / buttonWidth;
      float margin = (frameWidth - (numberOfcolumns * buttonWidth)) / (numberOfcolumns +1);
      int currentRow = 0;
      int currentColumn = 0;
  
      CATransition *animation = [CATransition animation];
      [animation setDelegate:self];
      [animation setType:kCATransitionReveal];
      [animation setDuration:0.4];
      [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]];
  
      int i = 0;
  
      for (UIView* curView in [mainPanel subviews]) {
          //set an arbutrary tag field in generating the scrollviews so i can detect this
          if (curView.tag != 9991) continue;
          //newline detection
          if (currentColumn == numberOfcolumns){
              currentRow++;
              currentColumn = 0;
          }
  
          [[curView layer] addAnimation:animation forKey:@"transitionViewAnimation"]; 
  
          //XY Coordinates
          int buttonX = (margin * (currentColumn + 1)) + (buttonWidth * currentColumn);
          int buttonY = (margin * (currentRow + 1)) + (buttonHeight * currentRow);
  
          //make the frame
          [curView setFrame:CGRectMake(buttonX, buttonY, buttonWidth, buttonHeight)];        
          [curView setAutoresizingMask: UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin];
          //put the button on the target uiscrollview
          [[curView layer] removeAnimationForKey:@"transitionViewAnimation"];
          //next column
          currentColumn++;
  
          i++;
      }
  
      animation = nil;
  }
  </code></pre>
  
  <p>How can animate this movement for sliding from a to b??</p>
  
  <p>Or better still if i have it all wrong, point me in the right direction :)</p>
  
  <p>Cheers</p>