0
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{
  if(toInterfaceOrientation==UIInterfaceOrientationPortrait ||toInterfaceOrientation== UIInterfaceOrientationLandscapeLeft|| toInterfaceOrientation==UIInterfaceOrientationLandscapeRight ||toInterfaceOrientation==UIInterfaceOrientationPortraitUpsideDown){
    return YES;
  }    else       return NO;
}


 -(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
self.string=text1.text;
self.string1=text2.text;
if(toInterfaceOrientation ==UIInterfaceOrientationPortrait)
{
    self.view=self.portrait;
    self.view.transform=CGAffineTransformIdentity;
    self.view.transform=CGAffineTransformMakeRotation(degreesToRadians(0));
    self.view.bounds=CGRectMake(0.0, 0, 320, 460);
    text1.text=[[NSString alloc]initWithString:string1];

}
if(toInterfaceOrientation==UIInterfaceOrientationPortraitUpsideDown){
    self.view=self.portrait;
    self.view.transform=CGAffineTransformIdentity;
    self.view.transform=CGAffineTransformMakeRotation(180);
    self.view.bounds=CGRectMake(0, 0, 320, 460);
    text1.text=[[NSString alloc]initWithString:string1];

}
if(toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft)
{
    self.view =self.landscape;
    self.view.transform=CGAffineTransformIdentity;
    self.view.transform=CGAffineTransformMakeRotation(degreesToRadians(-90));
    self.view.bounds=CGRectMake(0, 0, 480, 300);
    text2.text=[[NSString alloc]initWithString:string];
}
else if(toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
    self.view=self.landscape;
    self.view.transform=CGAffineTransformIdentity;
    self.view.transform=CGAffineTransformMakeRotation(degreesToRadians(90));
    self.view.bounds=CGRectMake(0, 0, 480, 300);
    self.text2.text=[[NSString alloc]initWithString:string];
}

} textfield should autorotate for all the orientation.

Upside down check box orientation is selected, while rotating from landscape to upside-down will animate method does not called how to solve

  • check the question and answer here. http://stackoverflow.com/questions/12260261/shouldautorotatetointerfaceorientation-not-being-called-in-ios-6 – Deepak Thakur Mar 24 '14 at 06:30
  • Follow this question http://stackoverflow.com/questions/20000503/issue-with-device-orientation-and-uiview-during-startup/20000670#20000670 – Parvendra Singh Mar 24 '14 at 07:15

0 Answers0