On Nov 12, 2008, at 10:00 AM, Stuart Malin wrote:
- (void) loadVew
{
contentView = [[UIImageView alloc] initWithFrame........];
...
self.view = contentView;
[contentView release];
...
}
*If* this is exactly the code shown, and contentView is an instance
variable, then this is a poor example. Particularly if contentView is
declared as a retained property:
@property (nonatomic, retain) UIImageView *contentView;
in which case the dealloc method should also release contentView and
you'll then crash when dealloc is invoked.
If contentView is declared as an assigned property:
@property (nonatomic, assign) UIImageView *contentView;
then the memory management is correct, but...
You are typically discouraged from assigning values to instance
variables anywhere other than in init methods. Elsewhere you should
use accessor methods, as this makes the memory management clear.
It would be better to do:
UIImageView *anImageView = [[UIImageView alloc] initWithFrame:...];
self.contentView = anImageView;
self.view = anImageView;
[anImageView release];
mmalc
_______________________________________________
Cocoa-dev mailing list ([email protected])
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 [EMAIL PROTECTED]