• 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: rotating UIView without changing size
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rotating UIView without changing size


  • Subject: Re: rotating UIView without changing size
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Fri, 03 Aug 2012 23:16:48 +0700

On 3 Aug 2012, at 22:50, David Duncan wrote:

> On Aug 3, 2012, at 8:34 AM, Gerriet M. Denkmann <email@hidden> wrote:
>
>> I have a subclass of UIViewController which displays a small view in the center of the display.
>> shouldAutorotateToInterfaceOrientation: returns YES.
>>
>> The problem:
>> when I rotate the device, the centered view rotates as it should. But it also changes its size to full-screen.
>>
>> The (bad) workaround:
>> in didRotateFromInterfaceOrientation: I set the frame back to a sensible value.
>>
>> Result: when I rotate the device, the view rotates, blows up to fill the screen, then snaps back to its real size.
>>
>> Is there a way to tell the ViewController to NOT mess with the size of its view (it should just exchange width and height)?
>
>
> I'm confused between your two claims.
>
> Above you say you have a view controller that displays a small view in the center of the screen. Below you say that this is the view controller's view (that is, the view assigned to the 'view' property).

There is a view (which fills the screen, let's call it basicView). When the user taps the screen, the small view - the view controller's view (that is, the view assigned to the 'view' property) - is shown in the middle of the screen. And this small centered view does rotate, when the device is rotated.

The basicView does not rotate.

> If you want a simple view in the center of the screen with a fixed size, then the simplest way to do so is to make that view a subview of the view controller's view. If you set the autoresizingMask correctly, then that view won't be resized at all, and should maintain its position in its superview (if nothing else ensuring the subview remains at the correct size and position should be much easier than what it seems you are trying to do above).

The autoresizingMask contains only dashed lines.


The code in basicView (an UIView) is:

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
	if ( self.sliderView == nil )	//	load nib
	{
		NSBundle *mainBundle = [ NSBundle mainBundle ];
		SliderViewController *tem = [ [ SliderViewController alloc ]	initWithNibName: 	@"Sliders"
																		bundle: 			mainBundle
																		biGroup: 			biGroup
																		cubeGlView: 		self
											];
		self.sliderViewController = tem;
		[ tem release ];

		self.sliderView = self.sliderViewController.view;
		self.sliderView.center = self.center;
		[ self addSubview: self.sliderView ];
	}

	self.sliderView.hidden = NO;
}


Kind regards,

Gerriet.


_______________________________________________

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: rotating UIView without changing size
      • From: David Duncan <email@hidden>
References: 
 >rotating UIView without changing size (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: rotating UIView without changing size (From: David Duncan <email@hidden>)

  • Prev by Date: Re: rotating UIView without changing size
  • Next by Date: loading UIView in correct orientation
  • Previous by thread: Re: rotating UIView without changing size
  • Next by thread: Re: rotating UIView without changing size
  • Index(es):
    • Date
    • Thread