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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 06-15-2009, 12:51 PM   #3 (permalink)
CanadaDev
Registered Member
 
Join Date: Mar 2009
Location: Toronto, ON
Posts: 111
Default

Quote:
Originally Posted by smasher View Post
You're saying that you create folderPath every time you need an image because you tried creating it just once, at the start of the app, but when you tried to use it later it was nil?
No it's not nil. I think the problem is that it's doing too much work when it loops through the code for every cell, or every time it loads the cell (on a scroll).

Quote:
That's probably becuase [NSString pathWithComponents] returns an autoreleased string - that string will get released unless you retain it in some way, like putting it in a property. If you've created a property, then this should do the trick:
Code:
self.folderPath = BLAH BLAH
otherwise, you just need a [folderPath retain].

PS - the way you're building the folderpath looks strange - you turn a string into an array with one item into a path. I think this would work just as well:
Code:
self.folderPath =[homeDirectoryPath stringByAppendingPathComponent:@"Images"];
Tried that. Removed the last line of code for the folderPath, and took your advice above. Still works as it should, although still quite slow on device.

Quote:
PPS - if things are still slow, consider keeping an array of filenames that you've already loaded - then you could check if an image is cached by checking if it's in the array, instead of hitting the filesystem with fileExistsAtPath.
I'll try to set that up today then. Will have to look into how.

Quote:
Also run through your code with the debugger - make sure that, for some reason, it isn't recreating the Images directory every time, or failing to use the cache for some reason.
I've now changed some stuff around so it only sets up the folder in the AppDelegate, but as far as I can see it only runs once.
CanadaDev is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,844
Threads: 89,212
Posts: 380,654
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jonesstr
Powered by vBadvanced CMPS v3.1.0

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