You must be logged in to post Login Register

Search 

Change image layer

User Post

3:21 am
August 10, 2008


jazzmic

Member

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


Brandon

Admin

brandontreb

posts 48

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.

10:20 am
August 10, 2008


crazyiez

Member

Wright State University

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

Member

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

Member

Wright State University

posts 30

5

NP. Glad i was right!

4:49 am
August 19, 2008


angadsk

New Member

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


About the iCodeBlog forum

Currently Online:

3 Guests

Maximum Online: 7

Forums:

Groups: 2

Forums: 6

Topics: 73

Posts: 264

Members:

There are 144 members

There are 1 guests


Brandon has made 48 posts

Top Posters:

crazyiez - 30

Uhu - 17

Nick - 15

bobcubsfan - 11

rawnaveen - 7

Administrator: Brandon


© - Version 3.1.3 (Build 356)  

Share and Enjoy: