The combined answers are Levy and Nikola Kirev, and now the code works correctly. Thanks to both of you. Here is the code for other links:
For iOS 6:
-(BOOL)shouldAutorotate{ return YES; } -(NSInteger)supportedInterfaceOrientations{ if (UIDeviceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation])) { self.viewProfile.frame = CGRectMake(238, 612, 295, 73); //other codes } else { self.viewProfile.frame = CGRectMake(374, 462, 295, 58); //other codes } return UIInterfaceOrientationMaskAll; } - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration{ if (UIDeviceOrientationIsPortrait(orientation)) { self.viewProfile.frame = CGRectMake(238, 612, 295, 73); //other codes self.profileNew.frame = CGRectMake(238, 713, 295, 73); } else { self.viewProfile.frame = CGRectMake(374, 462, 295, 58); //other codes } }
For iOS 5.x and 4.x
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if(interfaceOrientation == UIInterfaceOrientationPortrait||interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) { self.viewProfile.frame = CGRectMake(238, 612, 295, 73);
Noufal kmc
source share