Subscribe ( )

iPhone Programming Tutorials


 

Forum

You must be logged in to post Login Register

Search 

Change image layer

User Post

3:21 am
August 10, 2008


jazzmic

iCoder

posts 6

1

I'm working on a card game. To do that I'm loading the images as ImageViews and I can move them around without a problem. What I don't know is how to get rid of them when I don't need them anymore. Is “removeFromSubview” enough or does that leave them in memory, just not represented on screen?

The other question is, how can I control the layer order in which they are found. That would be, how can I know the depth in which they are found and how can I put them in a different depth, like when I click on one, it moves to the top of the cards?

Thankyou

9:11 am
August 10, 2008


Admin

brandontreb

posts 88

2

Hmmm…. Is there a reason that you are not doing this project in OpenGL ES?  It seems like it would be much easier to handle hiding/showing/layering your card objects.  That would be my suggestion as it seems to be much easier to do it that way than to do it using ImageViews.

But to answer your question about layering, I have found that the order of the layers seems to be dependent on the order in which you declare your visual components.  I have yet to see a method that allows you to change the order layers.  If you do find one, please post it here as I think some other forum members were interested in this functionality.

If debugging is the process of removing bugs, then programming must be the process of putting them in.
-Edsger Dijkstra

10:20 am
August 10, 2008


crazyiez

iCoder

posts 30

3

jazzmic said:

 What I don't know is how to get rid of them when I don't need them anymore. Is “removeFromSubview” enough or does that leave them in memory, just not represented on screen?


About the memory part. If you allocated memory for something then you have to release it otherwise your just wasting memory. you have to take it off the heap.

kind of like this *might be a poor example but it works*

 newEntry = [[funnyEntry alloc] init];

then you have to release that so if you allocated your cards release them when your done with them.

[newEntry release];

hope this helps in anyway.

11:09 am
August 10, 2008


jazzmic

iCoder

posts 6

4

Brandon: well.. I haven't learnt any OpenGL, and although I have thought of looking into it, I'm having enough problems with ObjectiveC, but will do!

Crazyies: That was embarassing (for me). True, you're absolutly right, thanks.

I've looked a litle more into the question I posted and it seems all could be done with CALayers, but then I think I loose the part where I can controll the images with the touch events…. hm… I'll look more into this.

11:44 am
August 10, 2008


crazyiez

iCoder

posts 30

5

NP. Glad i was right!

4:49 am
August 19, 2008


angadsk

Noob

posts 2

6

crazyiez said:

NP. Glad i was right!


Hi Jazzmic,

I need your help. I need to display a set of 9 images in a tabular format of 3X3. and wanna move these images..

Can you help me in this .. its kind of similar to the activity which you are doing .. I am new at this programming and i do this for fun.

Waiting for a positive response.

Regards

Angad

Search 

About the iCodeBlog forum

Most Users Ever Online:

44


Currently Online:

7 Guests

Forum Stats:

Groups: 2

Forums: 6

Topics: 419

Posts: 893

Membership:

There are 934 Members

There has been 1 Guest

There are 2 Admins

There is 1 Moderator

Top Posters:

bobcubsfan – 54

crazyiez – 30

Uhu – 17

AdeC – 17

Nick – 15

jitesh61 – 12

Administrators: Brandon (88 Posts), Collin (0 Posts)

Moderators: VertigoSol (26 Posts)



©   

  • Posted by on 6 Aug 2008 in Uncategorized
  •   |  
  •   |  
  •   |  
  • Comments Off

Comments are closed.