Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to query subview of UIView with tag?

i insert 2 UIImageView with tag 1 and 100 to UIView,

how to access to UIView and check how many subview on it or select tag 1 to be the top of view ?

like image 327
RAGOpoR Avatar asked Jul 01 '10 08:07

RAGOpoR


People also ask

How do I use viewWithTag?

If you need a quick way to get hold of a view inside a complicated view hierarchy, you're looking for viewWithTag() – give it the tag to find and a view to search from, and this method will search all subviews, and all sub-subviews, and so on, until it finds a view with the matching tag number.

What is tag in Swift IOS?

An integer that you can use to identify view objects in your application.

What is UIView in Swift?

The UIView class is a concrete class that you can instantiate and use to display a fixed background color. You can also subclass it to draw more sophisticated content.

What is a Subview Swift?

"subviews" means the views which are holding by the curent view. For example, you have a view (will call it as MyView) which include a button. Button is a view too (UIButton is a kind of view). So, MyView is superview for the button.


1 Answers

"check how many subview on it"

[myView.subviews count];

"or select tag 1 to be the top of view"

[myView bringSubviewToFront:[myView viewWithTag:1]];
like image 58
Ole Begemann Avatar answered Oct 12 '22 14:10

Ole Begemann