Контроллер моего представления содержит UIImageView и UITextView ниже. Это мой код:Мой текст не отображается внутри UITextView
#import <UIKit/UIKit.h>
@interface DescriptionViewController : UIViewController
@property (nonatomic, strong) IBOutlet UIImageView *descriptionImage;
@property (nonatomic, strong) IBOutlet UITextView *descriptionText;
@property (nonatomic, strong) NSString *text;
@property (nonatomic, strong) NSString *image;
@end
@interface DescriptionViewController()
@end
@implementation DescriptionViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.descriptionText = [[UITextView alloc] init];
self.descriptionImage.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:self.image]]];
self.descriptionText.text = self.text;
NSLog(@"%@", self.descriptionText.text);
}
@end
Мой код не отображается в TextView, но я могу напечатать его с помощью NSLog.
В чем может быть проблема?
Вы уверены, что ваш текст был просмотрен? установить цвет фона или что-то еще – hasan83
См. ответ ssantos: вам нужно подключить компонент textView с его выходом в Interface Builder. проверьте с помощью 'NSLog (@" tx:% @ ", self.descriptionText);' в конце 'viewDidLoad', если это значение равно нулю. и удалить строку ssantos. –