I was on the App Developers forum figuring out what I need to fill out to send in my first app and I saw someone was having problems with code crashing. In his post I saw this code
Right off the bat I knew [Self release]; is bad. But as I looked at it I saw that he created a method with no return, fine. Next he creates a UIImage object and assigns a png to it. Next step he makes a Rect for the image but then after all that it looks like he releases his navImage without doing anything with it, like add to subview, Dictionary or something.
Am I wrong in understanding it?
Code:
-(void)drawRect:(CGRect)rect
{
UIImage *navImage = [UIImage imageNamed: @"top bar image.png"];
[navImage drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
[navImage release];
[self release];
}
Right off the bat I knew [Self release]; is bad. But as I looked at it I saw that he created a method with no return, fine. Next he creates a UIImage object and assigns a png to it. Next step he makes a Rect for the image but then after all that it looks like he releases his navImage without doing anything with it, like add to subview, Dictionary or something.
Am I wrong in understanding it?