Question

I'm now doing an application, where i need to put some elements in the top of the views sometimes.

For example, how could i do to make the entire CGRect red and not the green visible here :

example

Could i call addSubview method more than one time, and it won't be sad in memory management ?

Because i've tried a lot of things, like :

[myUIImageView removeFromSuperview];
[muUIVew addsubview:myUIImageView];

or :

[myUIImageView didMoveToSuperview];

But it gaves me an error... Thank you !

Was it helpful?

Solution

No, you should call addSubview once. There are methods to manage subview position.

This is two methods you can use:

[muUIVew sendSubviewToBack: myUIImageView];

[muUIVew bringSubviewToFront: myUIImageView];

Should be pretty clear what they do.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top