forum

Home / DeveloperSection / Forums / Unable to set text field on UILabel

Unable to set text field on UILabel

Anonymous User171208-Sep-2015

I have created UITableCellView class called MyCell. The header defines the following:

#import< UIKit/UIKit.h>

#import "MyNote.h"

@interface MyCell : UITableViewCell {

    MyNote *note;

    UILabel *noteTextLabel; 

}

@property (nonatomic, retain) UILabel *noteTextLabel;

- (MyNote *)note;

- (void)setNote:(MyNote *)newNote;

@end

 

In the implementation I have the following code for the setNote: method:

- (void)setNote:(MyNote *)newNote {

    note = newNote;

    NSLog(@"Text Value of MyNote = %@", newNote.noteText);

    self.noteTextLabel.text = newNote.noteText;

    NSLog(@"Text Value of MyNote Text Label = %@", self.noteTextLabel.text);

    [self setNeedsDisplay];

}

This fails to set the text field of the UILabel and the output of the log messages is:

2008-11-03 18:09:05.611 VisualNotes[5959:20b] Text Value of MyNote = Test Note 1 

2008-11-03 18:09:05.619 VisualNotes[5959:20b] Text Value of MyNote Text Label = (null)

 

I have also tried to set the text field of UILabel using the following syntax:

[self.noteTextLabel setText:newNote.noteText];

This does not seem to make a difference.


Updated on 09-Sep-2015
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By