Re: Autorotation for a subview

2009-12-23 Thread Alexander Spohr
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


iPhone: Autorotation for a subview

2009-12-22 Thread Eric E. Dolecki
I have a view which controls it's UI when rotated. However, if there is a
subView in place, it rotates and I'd like to control it's UI too. In my
subView the willAnimateRotationToInterfaceOrientation doesn't get fired. I
set up the shouldAutorotateToInterfaceOrientation. Does my main view need to
call something in my subView to get this to work? I'd think the subView
would get the event too but it doesn't.

Eric
___

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


Re: iPhone: Autorotation for a subview

2009-12-22 Thread Development
What I have always had to do is rotate the new subview manually when it is 
added to the main view. I don't know if it's the right answer but it is what 
I've done.

On Dec 22, 2009, at 10:51 AM, Eric E. Dolecki wrote:

 I have a view which controls it's UI when rotated. However, if there is a
 subView in place, it rotates and I'd like to control it's UI too. In my
 subView the willAnimateRotationToInterfaceOrientation doesn't get fired. I
 set up the shouldAutorotateToInterfaceOrientation. Does my main view need to
 call something in my subView to get this to work? I'd think the subView
 would get the event too but it doesn't.
 
 Eric
 ___
 
 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/development%40fornextsoft.com
 
 This email sent to developm...@fornextsoft.com

___

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


Re: iPhone: Autorotation for a subview

2009-12-22 Thread Hank Heijink (Mailinglists)
On Dec 22, 2009, at 12:51 PM, Eric E. Dolecki wrote:

 I have a view which controls it's UI when rotated. However, if there is a
 subView in place, it rotates and I'd like to control it's UI too. In my
 subView the willAnimateRotationToInterfaceOrientation doesn't get fired. I
 set up the shouldAutorotateToInterfaceOrientation. Does my main view need to
 call something in my subView to get this to work? I'd think the subView
 would get the event too but it doesn't.

I assume you mean -willAnimateRotationToInterfaceOrientation:duration: which is 
a method on UIViewController, not UIView. If not, your signature is wrong and 
that method would never be called.

You'll need to manage your subviews from the controller when it receives the 
message. That's what the controller is for: views themselves are not aware of 
rotations.

Best,
Hank

___

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


Re: iPhone: Autorotation for a subview

2009-12-22 Thread Eric E. Dolecki
Well - the subView is really a settings view - so it can be called up at
any time. And of course the user can rotate the device around while it's
already being viewed. So I suppose I can call a method in my subview from
the willAnimateRotationToInterfaceOrientation:duration in the
UIViewController to have it lay itself out as needed. My subView is a view
controller too.

Eric

On Tue, Dec 22, 2009 at 1:04 PM, Hank Heijink (Mailinglists) 
hank.l...@runbox.com wrote:

 On Dec 22, 2009, at 12:51 PM, Eric E. Dolecki wrote:

  I have a view which controls it's UI when rotated. However, if there is a
  subView in place, it rotates and I'd like to control it's UI too. In my
  subView the willAnimateRotationToInterfaceOrientation doesn't get fired.
 I
  set up the shouldAutorotateToInterfaceOrientation. Does my main view need
 to
  call something in my subView to get this to work? I'd think the subView
  would get the event too but it doesn't.

 I assume you mean -willAnimateRotationToInterfaceOrientation:duration:
 which is a method on UIViewController, not UIView. If not, your signature is
 wrong and that method would never be called.

 You'll need to manage your subviews from the controller when it receives
 the message. That's what the controller is for: views themselves are not
 aware of rotations.

 Best,
 Hank




-- 
http://ericd.net
Interactive design and development
___

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


Re: iPhone: Autorotation for a subview

2009-12-22 Thread Eric E. Dolecki
Ok - I am doing this in my view controller which works better:

- (IBAction) displayInfo:(id)sender {

myInfoView = [[InfoViewController alloc] initWithNibName:@InfoViewController
bundle:[NSBundle mainBundle]];

myInfoView.view.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin |
UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin
| UIViewAutoresizingFlexibleBottomMargin);

[self.view addSubview:myInfoView.view];

}


But there is a button I'd like to move in the subView (in portrait its near
the bottom, in Landscape it needs to move up into view). What's the best way
of doing that?



On Tue, Dec 22, 2009 at 1:05 PM, Eric E. Dolecki edole...@gmail.com wrote:

 Well - the subView is really a settings view - so it can be called up at
 any time. And of course the user can rotate the device around while it's
 already being viewed. So I suppose I can call a method in my subview from
 the willAnimateRotationToInterfaceOrientation:duration in the
 UIViewController to have it lay itself out as needed. My subView is a view
 controller too.

 Eric


 On Tue, Dec 22, 2009 at 1:04 PM, Hank Heijink (Mailinglists) 
 hank.l...@runbox.com wrote:

 On Dec 22, 2009, at 12:51 PM, Eric E. Dolecki wrote:

  I have a view which controls it's UI when rotated. However, if there is
 a
  subView in place, it rotates and I'd like to control it's UI too. In my
  subView the willAnimateRotationToInterfaceOrientation doesn't get fired.
 I
  set up the shouldAutorotateToInterfaceOrientation. Does my main view
 need to
  call something in my subView to get this to work? I'd think the subView
  would get the event too but it doesn't.

 I assume you mean -willAnimateRotationToInterfaceOrientation:duration:
 which is a method on UIViewController, not UIView. If not, your signature is
 wrong and that method would never be called.

 You'll need to manage your subviews from the controller when it receives
 the message. That's what the controller is for: views themselves are not
 aware of rotations.

 Best,
 Hank




 --
 http://ericd.net
 Interactive design and development




-- 
http://ericd.net
Interactive design and development
___

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


Re: Autorotation for a subview

2009-12-22 Thread Matt Neuburg
On Tue, 22 Dec 2009 12:51:35 -0500, Eric E. Dolecki edole...@gmail.com
said:
I have a view which controls it's UI when rotated. However, if there is a
subView in place, it rotates and I'd like to control it's UI too. In my
subView the willAnimateRotationToInterfaceOrientation doesn't get fired. I
set up the shouldAutorotateToInterfaceOrientation. Does my main view need to
call something in my subView to get this to work? I'd think the subView
would get the event too but it doesn't.

This sounds like a good time for the view to post an NSNotification. The
subview can then respond to it. m.

-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

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


Re: Autorotation for a subview

2009-12-22 Thread glenn andreas

On Dec 22, 2009, at 1:01 PM, Matt Neuburg wrote:

 On Tue, 22 Dec 2009 12:51:35 -0500, Eric E. Dolecki edole...@gmail.com
 said:
 I have a view which controls it's UI when rotated. However, if there is a
 subView in place, it rotates and I'd like to control it's UI too. In my
 subView the willAnimateRotationToInterfaceOrientation doesn't get fired. I
 set up the shouldAutorotateToInterfaceOrientation. Does my main view need to
 call something in my subView to get this to work? I'd think the subView
 would get the event too but it doesn't.
 
 This sounds like a good time for the view to post an NSNotification. The
 subview can then respond to it. m.


Or just mark the subview as needing layout and then have the subview figure 
things out in layoutSubviews.


Glenn Andreas  gandr...@gandreas.com 
 http://www.gandreas.com/ wicked fun!
Mad, Bad, and Dangerous to Know

___

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


Re: Autorotation for a subview

2009-12-22 Thread Boulevardier

On Dec 22, 2009, at 11:01 AM, Matt Neuburg wrote:

 On Tue, 22 Dec 2009 12:51:35 -0500, Eric E. Dolecki edole...@gmail.com
 said:
 I have a view which controls it's UI when rotated. However, if there is a
 subView in place, it rotates and I'd like to control it's UI too. In my
 subView the willAnimateRotationToInterfaceOrientation doesn't get fired. I
 set up the shouldAutorotateToInterfaceOrientation. Does my main view need to
 call something in my subView to get this to work? I'd think the subView
 would get the event too but it doesn't.
 
 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.

A potentially better way to approach this is to look at the different roles and
responsibilities of View Controllers and Views, and gain a clearer understanding
of which class of objects does which job . . .

Think of a View Controller as a View *Manager*.The dominant paradigm for
presenting screens of content to users on the iPhone platform consists of a
View Controller managing a single enclosing View which, including all of
its sub-views, represents that screen of content.

In general, try to have your UIViews perform just two responsibilities.
First,
and by far the most important, is drawing their content.   Second is acting as
a container into which other Views may be added as sub-views.A very
distant third (which is why I said 'two' even though it makes me look as if I
can't count) is handling events, which task is frequently better managed in the
View Controller.

The View Controller implements methods to manage rotation, so
doing the work of View hierarchy layout and sub-view re-positioning and
re-sizing in the View Controller makes more sense than pushing the
job down into the sub-views. 

If the View Controller knows about its view's sub-views, it will then know
about their positions and sizes, and can perform simple re-positioning
and re-sizing to accomplish the job.

Finally, please try to use naming schemes where names of objects
bear at least a passing resemblance to what those objects actually are.I
refer to the line of code that reads:

myInfoView = [[InfoViewController alloc]

The code leads one to believe that the class named  InfoViewController  is a
sub-class of UIViewController.The variable name  myInfoView  leads one
to believe on casual inspection (and without adequate context) that the variable
references something that's a sub-class of UIView.Which is it ? List 
readers,
many of whom are trying to help, would be less confused if reasonable naming
schemes were employed.   The statement in an earlier message:

My subView is a view controller too.

Can not possibly be the case.A sub-view implies it's a UIView, and a UIView
can not be a UIViewController --- the two classes are on different branches of 
the
class hierarchy, and neither of them even define protocols that the other 
could adopt . . .

We had a thread on this list a couple of months ago where even some of
the more high-powered members of the list had tied themselves in knots and
were arguing at cross purposes because a poster asking for help had allocated
a UIImageView but called it an image . . .If you're asking for help, please 
try to
write code readable and understandable by other busy people . . .

Cheers,
. . . . . . . .Henry


iPhone App Developer Education --- visit  www.nonatomic-retain.com




 ___

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


Re: Autorotation for a subview

2009-12-22 Thread Matt Neuburg


On Dec 22, 2009, at 2:15 PM, Henry McGilton (Boulevardier) 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.


m.
 
___


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


Re: Autorotation for a subview

2009-12-22 Thread Eric E. Dolecki
Thanks all for the insight so far. I'm calling methods into the view - but I
think I need to redo how it works. I am interested in NSNotification as I
haven't used that yet.

On Tue, Dec 22, 2009 at 6:37 PM, Matt Neuburg m...@tidbits.com wrote:


 On Dec 22, 2009, at 2:15 PM, Henry McGilton (Boulevardier) 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.

 m.

 ___

 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/edolecki%40gmail.com

 This email sent to edole...@gmail.com




-- 
http://ericd.net
Interactive design and development
___

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


Re: Autorotation for a subview

2009-12-22 Thread mmalc Crawford

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


Re: Autorotation for a subview

2009-12-22 Thread 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/edolecki%40gmail.com

 This email sent to edole...@gmail.com




-- 
http://ericd.net
Interactive design and development
___

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


Re: Autorotation for a subview

2009-12-22 Thread mmalc Crawford

On Dec 22, 2009, at 5:09 pm, Eric E. Dolecki wrote:

 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. 
 
If you're using the code as shown, I can almost guarantee you will be leaking.
You don't show any code for releasing any previous instance of the view 
controller, so you'll be leaking that and so also its view.
Please review: 
http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html,
 and in particular Using Accessor Methods at 
http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/MemoryMgmt/Articles/mmPractical.html#//apple_ref/doc/uid/TP40004447.
  And again, this is not how view controllers are intended to be used -- see 
http://developer.apple.com/iphone/library/featuredarticles/ViewControllerPGforiPhoneOS/Introduction/Introduction.html

 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.
 
A desire to learn is certainly an admirable trait.  Given that the actual 
problem is still ill-specified, however, focussing on solving that issue would 
seem a more profitable strategy for now...

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