我需要在UITextView
中显示RTF file
。我的代码看起来像下面:错误消息NSData
我.h文件中:
@property (strong, nonatomic) IBOutlet UITextView *creditsTextView;
我.m文件
@synthesize creditsTextView;
- (void)viewDidLoad {
[super viewDidLoad];
NSData *creditsData = [[NSBundle mainBundle] pathForResource:@"Credits" ofType:@"rtf"];
NSAttributedString *attrString;
NSDictionary *docAttributes;
attrString = [[NSAttributedString alloc]
initWithRTF: creditsData documentAttributes: &docAttributes];
}
此代码给我下面的错误消息:
at
*creditsData : Incompatible pointer types 'NSData *' with expression of type 'NSString *'
,并在
initWithRTF : No visible @interface for 'NSAttributedString' declares the selector 'initWithRTF:documentAttributes:'
如何解决这两个错误?
什么'[NSBundle pathForResource:ofType:]'然后呢?这当然不是“Credits.rtf”的内容...... – trojanfoe