Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
533 views
in Technique[技术] by (71.8m points)

cocoa touch - Programmatically send to front/back elements created from interface builder

In interface builder, there are layout options to send to back or send to front any elements such as UIButton, UIImage, UILabel etc...

Now, I would like to do the same at runtime, programmatically.

Is there an easy way to do that?

I do not want to create different views, just update the z-axis.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There are a number of methods of UIView that allow you to modify the view hierarchy.

Since your views are already inserted into your superview, you could easily call bringSubviewToFront: once for each view in whatever order you like.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...