Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Knight Rider

macrumors newbie
Original poster
May 14, 2009
7
0
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?
 
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:

Code:
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" and the NSXMLParser Class Reference.
 
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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.