On 3 Aug 2012, at 23:59, David Duncan wrote: > On Aug 3, 2012, at 9:16 AM, Gerriet M. Denkmann <gerr...@mdenkmann.de> wrote: > >> 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; >> } > > > As I alluded to earlier, if you are going to use view controller containment, > you MUST use the containment API if you want sane behavior. The reason you > are getting this behavior is that based on your greater conditions, the > SliderViewController you just created is getting rotation callbacks, and > since it doesn't have a parent view controller would assume it is a full > screen view controller and sizes itself for that. > > I would recommend you either
> 1) adopt view controller containment and do this addition in the view > controller that owns basicView (which needs to be a subclass to do this > properly) of If I understand this correctly, I have to do: create a view controller for my basicView (currently there is none) and use [ basicViewController addChildViewController: sliderViewController ] and not use [ self addSubview: self.sliderView ]; Anything else I have to do? Any sample code, where I could study this? Any documentation I should read (about the containment API)? Any WWDC videos I should watch? The View Controller Programming Guide for iOS says: "The area each view controller fills is determined by its parent." But how? > 2) make SliderViewController not a subclass of UIViewController. If I use this alternative (might be easier to fit into my code) - how do I get notified of device rotations? Kind regards, Gerriet. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com