문제

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 !

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top