forum

Home / DeveloperSection / Forums / Problem in fixing TextField into UILabel

Problem in fixing TextField into UILabel

Anonymous User167606-Oct-2015

I was creating an app using UITableView and the class name is CellDemo, so I need to create UITableCellView class, the header definition is here:

#import <UIKit/UIKit.h>

#import "Book.h"

@interface CellDemo : UITableViewCell {

    Book *book;

    UILabel *bookTextLabel; 

}

@property (nonatomic, retain) UILabel *bookTextLabel;

- (Book *)book;

- (void)setBook:(Book *)newBook;

@end

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

- (void)setBook:(Book *)newBook {

    book = newBook;

    NSLog(@"Text Value of Book = %@", newBook.bookText);

    self.bookTextLabel.text = newBook.bookText;

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

    [self setNeedsDisplay];

}

After executing the code it fails and the output of log message is here:

2015-09-09 18:09:05.611 VisualBooks[5959:20b] Text Value of Book = Test Book 1 

2015-09-09 18:09:05.619 VisualBooks[5959:20b] Text Value of Book Text Label = (null)

 And I also try to set the text field into UILabel using this code:

[self.bookTextLabel setText:newBook.bookText];

 This also generates same type error.

Please help me.


Updated on 06-Oct-2015
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By