Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 03-18-2010, 12:03 AM   #1 (permalink)
soonio
Registered Member
 
Join Date: May 2009
Posts: 11
soonio is on a distinguished road
Default Can someone please confirm this code? ([object release] issue)

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 addSubviewic];

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

[pic release];

}
soonio is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 175,542
Threads: 94,064
Posts: 402,675
Top Poster: BrianSlick (7,989)
Welcome to our newest member, DieScumBag
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:37 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.