how to get UIView by tag

how to get UIView by tag

In IOS application how to get a view by the tag id?

Thanks

View Answers

March 4, 2015 at 7:25 AM

Hi,

You can get this with the help of the function 'viewWithTag''.

Following example code is getting the UILabel object from the current view:

UILabel *label = (UILabel *)[self viewWithTag:100];

There is another way of getting the objects from the subview and then finding the desired view:

for (UIView *i in self.view.subviews){
      if([i isKindOfClass:[UILabel class]]){
            UILabel *newLbl = (UILabel *)i;
            if(newLbl.tag == 1){
                /// Write your code
            }
      }
}

Thanks









Related Tutorials/Questions & Answers:
how to get UIView by tag
how to get UIView by tag  In IOS application how to get a view by the tag id? Thanks   Hi, You can get this with the help of the function... view: for (UIView *i in self.view.subviews){ if([i isKindOfClass:[UILabel
how to get the anchor field in hidden field tag
how to get the anchor field in hidden field tag  I have a following code I need to have the value of property "emp" in a hidden field also. when i try to put the following code, I cant get the hidden tag when i see the source
Advertisements
how to get the value of a label field of option tag in javascript?
how to get the value of a label field of option tag in javascript?  example <select> <option label="2" value="A">A<...;/select> can i get the label value in javascript
Creating UIView Programmatically
Creating UIView Programmatically The example will show you how to create a UIView programmatically. In the previous example, we have illustrated you how to load the next UIView using pushViewControler. This example is also similar
UIView Access Subviews
UIView Access Subviews In the example, you'll learn how to create and access a subview on UIView. Syntax of adding subview at UIView. - (void)addSubview:(UIView *)view; Creating and accessing a subview : In the example we
uiview alloc initwithframe
uiview alloc initwithframe  Hi, How I can make uiview programmatically? Tell me good code for UIView alloc using initwithframe method. Thanks   Hi, You can use following code: UIView *modalView = [[[UIView alloc
UIView Background Image
UIView Background Image  HI, Please let's know how to add background image to a view? Thanks   Hi You can use the following code...:@"myimage.png"]]; Read more at UIView Image Background Tutorial page. Thanks
subview with tag
subview with tag  Hi, How to access the subview of a view with the tag identifier? Thanks   Hi, Following code might useful: UIView *modalView=(UIView *) [self.view viewWithTag:101]; [modalView removeFromSuperview
UIView landscape only
UIView landscape only  HI, How to display your view in landscape orientation only? Thanks   Hi, You use the following code in your view controller class: - (BOOL)shouldAutorotateToInterfaceOrientation
UIView Image Background
UIView Image Background In this tutorial, we are going to show you how to add image at background in UIView. There are two different ways of adding background image in your iphone application.. 1. Either you can set the UIView
changing uiview background color
changing uiview background color  changing UIView background color in ios   self.view.backgroundColor = [UIColor colorWithRed:244.0f/255.0f green:230.0f/255.0f blue:183.0f/255.0f alpha:1.0f
add imageview to uiview
add imageview to uiview  i want to add an image to UIView background.   self.view.backgroundColor = [UIColor colorWithPatternImage... to UIView Add an Image or Image URL to your ImageView. Code: UIImageView
how to use image tag in jsp
how to use image tag in jsp  How to use image tag in JSP
UIView frame x,y width and height
UIView frame x,y width and height  HI, How to print the x,y width and height of UIView? Thanks   Hi, Following code can be used: CGRect myFrame = myview_.frame; NSLog(@"height = %f", myFrame.size.height); NSLog
How to add another option to the select tag using struts2 tag - Struts
How to add another option to the select tag using struts2 tag  Hi, How to add another option to select tag using tag. My scenario is : If the logged in user is admin then drop down should contain the normal list
How to access the following tag from xml to jsp
How to access the following tag from xml to jsp  How can i get the title where cat="1" and "My Title" from XML File?   Please visit the following link: http://www.roseindia.net/jsp/parsing-xml.shtml The above link
How To Write the FORM Tag Correctly for Uploading Files?
How To Write the FORM Tag Correctly for Uploading Files?  How To Write the FORM Tag Correctly for Uploading Files
How to configure mvc:default-servlet-handler tag?
How to configure mvc:default-servlet-handler tag?  How to configure mvc:default-servlet-handler tag? Please feel free to suggest examples or any reference websites. Thanks
How to read the body content of custom tag?
How to read the body content of custom tag?  I'm unable to read the body content specified between start tag and end tag of a JSP custom tag...); method. I want to read the body content of any custom tag and manipulate
How to access the Title tag from xml to jsp
How to access the Title tag from xml to jsp  How to access the Title tag from xml to jsp   Please visit the following link: http://www.roseindia.net/jsp/parsing-xml.shtml The above link will provide you an example
How to Use Struts 2 token tag - Struts
How to Use Struts 2 token tag  Hi , I want to stop re-submiiting the page by pressing F5, or click 'back n press submit' button again, i want to use 'token' tag for it, but not able to find out how does it works, I' ve put tag
How to get Button Id ?
How to get Button Id ?  How to get Button ID instead of its value in Servlet. (I am not using jsp right now
how to get radio value
how to get radio value    how to retrive the option value and insert the next table pls give example
how to get following output
how to get following output  input 123456 output 1 2 3 4 5 6
how to get following output
how to get following output  input 123456 output 1 2 3 4 5 6
How to get project path
How to get project path  my problem is,i have one jar file,in that one xml is their,i am adding this jar file to my project,my question is how i can open or get that xml path
How to get project path
How to get project path  my problem is,i have one jar file,in that one xml is their,i am adding this jar file to my project,my question is how i can open or get that xml path
How to get Java SDK
How to get Java SDK  Hi, I have purchased a new computer and installed windows 7. Now I have to get the Java SDK and install on my computer for developing and testing Java programs. So, can anyone tell me How to get Java SDK
How to get factorial in mysql
How to get factorial in mysql  Hi, In order to improve the speed of my queries, one in particular tries to find matches between multiple tables, I am trying to use prime numbers to speed the process, but I have been googling
How to Get this Output
How to Get this Output  1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1   Done It public class star { public static void main(String[] args) { for(int i=1;i<=5;i
How to get the Day name
How to get the Day name  Hi, I am a beginner in Java and new to this web world as well. have a requirement to implement in my assignment project as below: We need to add the days in input date such that it create the date
How to get involved
How to get involved       Shopping cart application gives you many opportunities... Application Report bugs and request features and enhancement Get familiar
Getting next Tag in the XML File
Getting next Tag in the XML File       This Example shows you how to get the next Tag from the XML... = reader.next():-By using this method we get the next parsing event.ADS
How to get data datagrid ?
How to get data datagrid ?  How to get data datagrid in jsp from arrayList in java? Code in java CategoryDao dao = new CategoryDao(); ArrayList<Categories> lstCategory = new ArrayList<Categories>
How to get the position of the comments in the pdf
How to get the position of the comments in the pdf  how to get the postion of comments, in the extracted xml, from pdf
How to get the position of the comments in the pdf
How to get the position of the comments in the pdf  how to get the postion of comments, in the extracted xml, from pdf
How to use Hibernate get sessionfactory?
How to use Hibernate get sessionfactory?  Hi, How to use hibernate get sessionfactory? Thanks
how to get the checkbox value in jsp
how to get the checkbox value in jsp  how to get the checkbox value in jsp?   JSP CheckBox Example - how to get the checkbox value in jsp
how to get this xml syntx in java??????
how to get this xml syntx in java??????  how to get this xml syntx in java?????? < comp xlink:type="new" xlink:actuate="onload"/>
how to get this xml syntx in java??????
how to get this xml syntx in java??????   how to get this xml syntx in java?????? < comp xlink:type="new" xlink:actuate="onload"/>
How to get browser time zone?
How to get browser time zone?  How to get browser Time Zone and browser date using java concept
How to get Output for a Bean problem
How to get Output for a Bean problem  Hello Kindly tell me a simple Program on Bean to get the Output using JSP code
What is VPN and How to get it?
What is a VPN and How can you get it? Today, VPN is very popular among.... In this post we are going to learn What is a VPN and how you can get it for your home... as an internet gateway. How to get a VPN? There are few free VPN services
What is VPN and How to get it?
What is a VPN and How can you get it? Today, VPN is very popular among.... In this post we are going to learn What is a VPN and how you can get it for your home... as an internet gateway. How to get a VPN? There are few free VPN services
how to call servlet from html page at anchor tag ?
how to call servlet from html page at anchor tag ?  I have a very different problem as i am using netbeans ide 6.9 ml to make a website in java... buttons image and for referrence i use anchor tag {for ex: ()} to go
How to get enum value in Java
How to get enum value in Java  Hi all, i am looking for a solution to get an enum value from index in Java. Please suggest. Thanks
How to get the current date in Java?
How to get the current date in Java?  Hi, I am new to Java and trying to write a program to get the current date. How to get the current date in Java? Thanks   Hi, Check the tutorial: Java program to get current date
how to divide 1 web page into some parts using div tag...
how to divide 1 web page into some parts using div tag...  how to divide 1 web page into some parts. i know it using frames in html,bt how can we do it in jsp. my friend told it can b done using div tag. i ve tried bt couldnt do
How to send the request and get the request?
How to send the request and get the request?  how to send a request to a JSP file in another domain in the same server and get the request done i.e how to include JSP file of one domain to another doamin JSP within in the same
How to get a values - JSP-Servlet
How to get a values  Dear sir, I have one input text field and one submit button .Within one file how to get a values within a same jsp. Thanks and Regards Harini Veerapur.  Hi Friend, Try the following

Ads