Display xml tags in label

Discussion in 'iOS Programming' started by Knight Rider, May 14, 2009.

  1. Knight Rider macrumors newbie

    May 14, 2009
    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?
  2. jnic macrumors 6502a

    Oct 24, 2008
    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" and the NSXMLParser Class Reference.
  3. Knight Rider thread starter macrumors newbie

    May 14, 2009
    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

Share This Page