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:44 AM   #4 (permalink)
soonio
Registered Member
 
Join Date: May 2009
Posts: 11
soonio is on a distinguished road
Default

Quote:
Originally Posted by AlexTheMighty View Post
Don't see any leaks (as long as you make sure to remove the "pic" view later instead of just creating a new UIImage view on top of it. (Also if you want to check code for leaks, the Leaks tool included in the XCode env is great for exactly this sort of thing, and is defiantly something to learn how to use).
My question would be though, if you use this view a lot and are constantly calling this code, why not just keep the UIImageView around and simply replace the image it contains? Constantly creating a new UIImageView seems like the roundabout way of replacing an old image. Save yourself (and the device) some work and just do it once.
Thank you for your quick reply! The reason I don't replace the image is that I want the picture to remain visible for the duration of animation... when I replace it, then the old picture disappears... if you understand what I mean. The actual code I use (which I didn't mention in the thread to make things simple) is:

- (void)showTouchedPoint_XCoordfloat)XCoord YCoordfloat)YCoord {

UIImageView *touchedPointImageView = [[UIImageView alloc] init];

touchedPointImageView.image = [UIImage imageNamed:@"touchedPoint.png"];
touchedPointImageView.frame = CGRectMake(XCoord, YCoord, 20, 20);
touchedPointImageView.alpha = 0.8;
[self.view addSubview:touchedPointImageView];

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

[touchedPointImageView release];

}

Can you please have a look at it again and tell me if this is ok? Also when I release the imageview, then the allocated uiimageview object is freed and so is the memory for that object, right? (sorry for the noobiness of the question.)
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.