我需要在 a 中显示RTF file
一个UITextView
。我的代码如下所示:
我的 .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];
}
此代码给了我以下错误消息:
在
*creditsData : Incompatible pointer types 'NSData *' with expression of type 'NSString *'
并且在
initWithRTF : No visible @interface for 'NSAttributedString' declares the selector 'initWithRTF:documentAttributes:'
如何解决这两个错误?