rtrying to free memory

Discussion in 'iOS Programming' started by imaumac, Nov 22, 2008.

  1. macrumors member

    Oct 15, 2008
    Hi, i just want to know if some one here can help me to free memory runing my app.

    I am working books (app) with more than 45 UIViews jumping with buttons between UIViews.......and every UIView have a background 320x480 png picture.

    here show 2 graphics how i am using:



    then my 2 questions are:

    first, what code i have to put to remove from super view and free more memory removing UIViews

    and second: where i have to put that xcode.

    some people give me this next code: but i dont know how use it, and where to use it.

    myView = [[UIView alloc] init]

    or this one:

    [UIView imageNamed:mad:"myImage"]

    some idea please ?
    thanks a lot brothers.!
  2. macrumors member


    Sep 22, 2008
    You should not have that many UIViews! You can change the image of an UIImageView programatically! You need only have 2 (current, next) or 3 (previous, current, next) views and change the images. That saves a LOT of memory and makes the application MUCH MORE responsive.
  3. thread starter macrumors member

    Oct 15, 2008
    thanks for your answer.
    please, realy please !
    could you guide me how to do this ?

    and i want to add, that I use buttons to show pictures on every UIView.
    and here is the code that I use to show and hide pictures by pressing a button.

    - (IBAction) call_image1: (id) sender {
    [jpg_image1 setHidden:NO];}

    - (IBAction) call_image1_hide: (id) sender {
    [jpg_image1 setHidden:YES];}

    dont know if this help.
    but i realy need to learn how change the :
    and buttons just with xcode.

    please help !
    I learned this way, jumping between UIViews

Share This Page