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