Re: Autorotation for a subview
Re: Autorotation for a subview
- Subject: Re: Autorotation for a subview
- From: "Eric E. Dolecki" <email@hidden>
- Date: Tue, 22 Dec 2009 20:09:51 -0500
I already stated (I believe) that I needed to redo the way this application
is being constructed. In this way I'll have more direct access to subviews.
I originally created another view controller with it's own nib and I was
indeed loading it and using it as a subview to my main view. No leaks since
it's removed itself from superview.
In regards to the NSNotification, I look at that as a learning opportunity
and not merely a way of throwing some code at a problem hoping it will make
it "work". I haven't ever used it before - I've only been part-timing iPhone
apps for about 7 months now. It's fascinating and exciting and humbling when
you're trying to do something and were unaware of the proper framework or
methods to use.
Eric
On Tue, Dec 22, 2009 at 7:37 PM, mmalc Crawford <email@hidden> wrote:
>
> On Dec 22, 2009, at 3:37 pm, Matt Neuburg wrote:
>
> >>> This sounds like a good time for the view to post an NSNotification.
> The
> >>> subview can then respond to it. m.
> >>
> >> Sounds like overkill --- swatting mosquitoes with sledgehammers.
> >
> > An NSNotification is not a sledgehammer. And letting interested listeners
> know that a certain key moment in the lifetime of the application has been
> reached, is not a mosquito. Indeed, this is why something like
> UIApplicationDidFinishLaunchingNotification *is* a notification. Sometimes
> the delegate or subclass instance is not the only interested party; the
> moment where didRotateFromInterfaceOrientation: arrives might be such a
> case.
> >
> Using a notification per se is not a sledgehammer.
> Setting up your own view to post notifications for this situation, however,
> almost certainly is (*insofar as it's possible to determine the OP's
> requirements, given the confused problem description...*).
> There is already a perfectly good mechanism for communicating changes about
> a device's orientation through an object that's in the best place to respond
> to such changes -- UIView*Controller*'s
> willAnimateRotationToInterfaceOrientation... et al. methods.
>
> On Dec 22, 2009, at 4:25 pm, Eric E. Dolecki wrote:
> > I am interested in NSNotification as I haven't used that yet.
> >
>
> It's not clear if you're trying to solve a problem or learn about iPhone OS
> programming in general.
> Unthinkingly chasing "interesting" API is not a particularly useful
> strategy for solving a problem.
> Per Henry's reply, you should properly describe what the task is you're
> trying to accomplish using terminology and conventions that will best help
> those trying to help you.
>
> Hint; this:
> > - (IBAction) displayInfo:(id)sender {
> >
> > myInfoView = [[InfoViewController alloc] initWithNibName:@
> "InfoViewController"
> > bundle:[NSBundle mainBundle]];
> >
> > myInfoView.view.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin
> |
> > UIViewAutoresizingFlexibleRightMargin |
> UIViewAutoresizingFlexibleTopMargin
> > | UIViewAutoresizingFlexibleBottomMargin);
> >
> > [self.view addSubview:myInfoView.view];
> >
> > }
> >
> makes almost no sense.
>
> Using a view controller to instantiate a view to add as a subview of
> another view that is presumably managed by another view controller is not a
> supported pattern. You're also ignoring basic memory management guidelines,
> and will almost certainly be leaking both the view controller and its
> accompanying view. Adding notifications to this scenario will not end
> prettily.
>
> mmalc
>
> _______________________________________________
>
> 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
>
--
http://ericd.net
Interactive design and development
_______________________________________________
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