View Full Version : Display xml tags in label
Knight Rider
May 14, 2009, 08:36 AM
I’m trying to parse an XML file having ‘n’ number of questions. I have to display those questions in labels at runtime in a view. That means ‘n’ labels for ‘n’ questions and ‘n’ labels for ‘n’ answers too. Does anyone have any suggestions about how to do this?
jnic
May 14, 2009, 09:45 AM
I’m trying to parse an XML file having ‘n’ number of questions. I have to display those questions in labels at runtime in a view. That means ‘n’ labels for ‘n’ questions and ‘n’ labels for ‘n’ answers too. Does anyone have any suggestions about how to do this?
Do you mean "how do I add labels on the fly?" If so:
UILabel *label = [[UILabel alloc] initWithFrame:whatever];
label.text = @"whatever";
[self.view addSubview:label];
Unless you're asking how to do the whole thing? If so, see "Using NSURLConnection (http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html)" and the NSXMLParser Class Reference (https://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSXMLParser_Class/Reference/Reference.html).
Knight Rider
May 24, 2009, 05:44 AM
Thanks for reply...
I got the labels on view by above code...
Now i want tp display these labels on a different view..
I am parsing XML in RootViewController and want these controls on LoginViewController as soon as i get the Tag..
So I can not use self.view..
What should i use?
I am using NSXMLParser
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.