I have a small method which is called to show a small picture on the screen for a short period of time. This method is called lots of times during the life of the application.
In summary, I dynamically allocate the UIImageView object and then release it. Will the following code give me a memory leak? is this correct way of doing such an action? any better way?
Thank you so much in advance!
- (void)showPicture {
UIImageView *pic = [[UIImageView alloc] init];
pic.image = [UIImage imageNamed:@"aPicture.png"];
pic.frame = CGRectMake(20, 20, 20, 20);
pic.alpha = 1.0;
[self.view addSubview

ic];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
pic.alpha = 0.0;
[UIView commitAnimations];
[pic release];
}