Eric,

1. Can’t you use autoresizingMask for all subviews? You can do pretty much 
automagic with it. Just let your Button hang to the lower and right borders.
A view should not resize/reposition itself.

2. Don’t put the view of controller B into a view of controller A.
Why not presentModalViewController:animated:?

3. is a question from me to the knowing:
It seems that when didRotateFromInterfaceOrientation: is called, all views are 
still in the old orientation. Is this correct? If so I will file a bug because 
after it DID rotate the views should all have their new position / size.

        atze



Am 23.12.2009 um 02:09 schrieb Eric E. Dolecki:

> 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 <mmalc_li...@me.com> 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 (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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to