Equivalent for reloadData, but for UILabel (not UITableView)

Discussion in 'iOS Programming' started by beesbane, Oct 16, 2010.

  1. beesbane macrumors newbie

    Joined:
    Oct 16, 2010
    #1
    I have been working on learning xcode and apps since may or so, and I am working on one now that passes information through xml, and populates an IB file.

    The root view is a table view, and when one thing is selected, everything works, but when I navigate back to that view and try to load another, the information has not been released.

    I am basing this model of of a sample code I was learning from, and it had passed the information into another tableView, and called reloadData after it had been loaded in. This function however, does not work with UITextView, or UILabel view. How would I do this instead?

    The IBOutlets are properties, nonatomic, assign.

    Thanks
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    reloadData works/is required as UITableViews have datasources that provide the data. Other views like labels and text views don't. There is no analogous concept. You simple set the text to display when you want to change the text displayed.
     
  3. beesbane thread starter macrumors newbie

    Joined:
    Oct 16, 2010
    #3
    Wow, thanks for the quick response.

    So all I need to do is set up the outlets? I don't need to release them or reload them or reset them?

    for example:

    UILabel.text = XMLString
     
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    Outlets? If we are not talking about Interface Builder, where specific properties may be exposed as Outlets then that word makes no sense. Whether you need to release them or not depend on how you have got the string. You may or may not need to release a string after setting the text property of a UILabel (the UILabel will retain the string).
     
  5. beesbane thread starter macrumors newbie

    Joined:
    Oct 16, 2010
    #5
    Yes, IBOutlets.

    I need it to release, but can't get it to.

    Here is what I'm doing:

    .h

    @interface FirstViewController : UIViewController {

    IBOutlet UILabel *nameTitle;

    XMLstuff *XMLinfo;

    }

    @property (nonatomic, retain) XMLstuff *XMLinfo;

    //@property (nonatomic, assign) IBOutlet UILabel *nameTitle;


    @end

    .m

    @synthesize XMLstuff;

    - (void)viewDidLoad {
    nameTitle.text = aBook.name;
    [super viewDidLoad];
    }

    - (void)dealloc {

    [XMLstuff release];
    [nameTitle release];
    }

    result:

    first selection works fine, return to root view, any other selection retains first selection's information.

    I can't figure how to release or reload the data.
     

Share This Page