• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
iOS: Manually setting orientation makes a mess out of my interface
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

iOS: Manually setting orientation makes a mess out of my interface


  • Subject: iOS: Manually setting orientation makes a mess out of my interface
  • From: Development <email@hidden>
  • Date: Sat, 04 Jun 2011 20:31:22 -0700

Ok

when my application first starts up I want it in portrait mode. However when a user switches to an editor it needs to transform in to landscape mode.

I have this working more or less correctly.

However, when I leave the editor, it switches back to portrait amd all of the portrait views are a mess.

I was able to get the very first portrait view to display correctly.
But when I switch to a new portrait view it has been resized to 460px high. And no matter what I do I absolutely cannot set it back to the correct 480px high.
nor can I get it to display lower on the screen to correct the display

I've attempted to change both the bounds and frame and nothing happens it seems to have become read only.

How does one correct view sizes and origins when switching back from a manually set orientation to the original one?

this is my rotator:

-(void)rotateMainViewToOrientation:(UIDeviceOrientation)orientation
{


	[UIView beginAnimations:@"View Flip" context:nil];
	[UIView setAnimationDuration:.5];
	[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

	[[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];

    [[UIApplication sharedApplication]setStatusBarOrientation:orientation];
    //NSLog(@"2");

    CGPoint newOrig =CGPointMake(0.0, 0.0);
    int dir = 90;
	if(!ISIPAD){
        if (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight){
            if (orientation == UIDeviceOrientationLandscapeRight) {
                dir = 270;
            }
		self.view.frame = CGRectMake(0.0, 0.0, 480, 320);
		self.view.center = CGPointMake(160.0f, 240.0f);
        }
        else{


            if(self.view.frame.size.width >320){
             //does nothing
                newOrig.x = -80;
                newOrig.y = 80;


            }
            self.view.center = CGPointMake(240.0f, 160.0);
            if(orientation == UIDeviceOrientationPortrait){
                dir = 0;
            }
            else{
                dir = 180.0;
            }
        }
	}
	else {
        if (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight){
            if (orientation == UIDeviceOrientationLandscapeRight) {
                dir = 270;
            }
            else dir = 90;
            self.view.frame = CGRectMake(0.0, 0.0, 1024, 768);
            self.view.center = CGPointMake(1024.0/2.0f, 768.0/2.0f);
        }
	}
    self.view.transform = CGAffineTransformIdentity;
    self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(dir));
    self.view.transform = CGAffineTransformTranslate(self.view.transform, newOrig.x, newOrig.y);

	[UIView commitAnimations];
}_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: iOS: Manually setting orientation makes a mess out of my interface
      • From: Development <email@hidden>
  • Prev by Date: Re: crash in ThemeTextRelease
  • Next by Date: Re: iOS: Manually setting orientation makes a mess out of my interface
  • Previous by thread: NSMatrix with radio buttons dynamically filled via bindings - wrong layout
  • Next by thread: Re: iOS: Manually setting orientation makes a mess out of my interface
  • Index(es):
    • Date
    • Thread