Fast image loading with Three20

I get a lot of complaints about the slow swipe action in ICHC, as a result of loading each image the first time they appear. Although I added caching in version 1.5, I chose to do it that way to minimize the memory usage and avoid low memory crashes.

I’ve been looking at ways to improve the speed and one of the best options seems to be to rewrite it using Joe Hewitt’s Three20 framework. As a proof of concept, I wrote a simple test program which loads a pre-defined set of images. The scrolling & image loading performance is excellent.

Note this is just a proof of concept. I haven’t figured out all of the details of how to implement it in the actual application. The major hurdle is that I need to handle mixed photos & videos in a single stream, while the photo browser only handles photos.

Of course there won’t be any new updates until Apple approves the updates that have been in review for over a month, as well as the new updates I submitted a week ago with.

4 responses to “Fast image loading with Three20

  1. Hey Mike,
    I was wondering how you initiliaze the Photo with TTPhoto?
    I keep looking in his header files and cant find how to INIT this object with a UIImage? or a file?
    thnx

    • I haven't tried using a UIImage. It seems to require a URL since TTPhoto protocol has a required method to return the URL:

      – (NSString*)URLForVersion:(TTPhotoVersion)version

      I originally tried creating a file: URL, but it failed to load because the URLRequest object used internally by TTPhotoSource expects a remote URL.

  2. Hey Mike,
    Thanks for your reply.
    This basically renders three20 useless for anyone who stores images locally in their app with either sql plist or just there in the bundle?

    You load images from the web in your application?
    Then my question is how does the built in photo viewing app handles that? and is there any way to reproduce it? Do we transition views? animate UIImageView or use scroll view horizontally? All i am trying to do is NOT to reinvent the wheel all over again and focus on more important functions in the app instead of image viewing….

    Thank you in advance for your reply.

  3. Alex,

    Your best bet would be to check the Three20 group, http://groups.google.com/group/three20. There are people there, including the developer, who know more about it than I do.

    Digging deeper into the code I see that there are methods in TTURLCache to load images from the bundle & from a document, but I haven't figured out where they're used.

Leave a Reply