• 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
Re: iOS: Manually setting orientation makes a mess out of my interface
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


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

k.. at this point I'm begging
can any one tell me how to shift from portrait to landscape and back again.
I know this is possible I see it in games all the time.

On Jun 4, 2011, at 8:31 PM, Development wrote:

> 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

_______________________________________________

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

References: 
 >iOS: Manually setting orientation makes a mess out of my interface (From: Development <email@hidden>)

  • Prev by Date: iOS: Manually setting orientation makes a mess out of my interface
  • Next by Date: Howto eliminate the delay for the first call of -(NSMenu*)menuForEvent: (NSTableView class)?
  • Previous by thread: iOS: Manually setting orientation makes a mess out of my interface
  • Next by thread: Howto eliminate the delay for the first call of -(NSMenu*)menuForEvent: (NSTableView class)?
  • Index(es):
    • Date
    • Thread