Loading lots of images to UITableView

Discussion in 'iOS Programming' started by appletree11, Mar 9, 2009.

  1. appletree11 macrumors newbie

    Joined:
    Mar 9, 2009
    #1
    My program loads hundreds of images to a UITableView. I got it to work. The problem is that when I switch from Debug mode to Distribution, the images do not show up anywhere. It works fine in Debug mode, all the images show up. I even tested it on an actual Iphone and it works great. I don't know why switching to Distribution mode changes things. Any help will be appreciated. Here's the codes to load the images in cells:

    UIImage *img = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:fileN ofType:mad:"png"]];

    cell.image = img;

    return cell;
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    Distribution builds are not meant to run on devices; there are solely for packing up your app for submission to Apple. Maybe you want Release configuration?
     
  3. appletree11 thread starter macrumors newbie

    Joined:
    Mar 9, 2009
    #3
    Hi Dejo

    You have to set it to Distribution in order to submit to app store. Actually, I did it submit the app and was rejected. Are you saying that after the app is submitted to the app store, that they have to change it to Release mode? Should I submitted it again?

    Thanks.
     
  4. jnic macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
    #4
    You build for testing in Debug or Release mode. You submit in Distribution mode.
     
  5. appletree11 thread starter macrumors newbie

    Joined:
    Mar 9, 2009
    #5
    hi

    Actually, the images are not loading for both Release and Distribution modes. Why is that? It works great in Debug, but not otherwise. Is there anything wrong with my codes.

    Here's what's going on with my app. There are hundreds of images I loaded in the Resources folder. I have sql file containing info on image names and other info. I load the sql file into arrays and load images in a UITable using those info.

    It's there a better way of doing this? Have anyone had experience with using lots of images in there apps? Thanks for your replies.
     
  6. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #6
    Why are you not using imagedNamed: to load your images?
    Don't worry about testing in Distribution mode. That's not what it's meant for. As for why you see a difference between Debug and Release modes, that is strange.
     
  7. appletree11 thread starter macrumors newbie

    Joined:
    Mar 9, 2009
    #7
    Hi

    I think I got it to work. I don't know why or how, but when I saved the images in Photoshop it seems to work. I had used Gimp to save the images as png. But, I guess the format it used to save it is wrong or not been recognized. But I guess, i have to resave everything in Photoshop. Thanks guys.
     
  8. marlenez macrumors newbie

    Joined:
    Aug 25, 2008
    #8
    He's would have memory leak problems using imageNamed even though imageWithContentsOfFile is slower it works.

    If Apple ever fixes this bug imageNamed will rock!
     
  9. jnic macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
    #9
    There's a memory leak bug in imageNamed?
     

Share This Page