Displaying a .rtf file in an UIWebView

后端 未结 2 1588
离开以前
离开以前 2020-12-21 05:26

I\'m trying to display a .rft file which is download for my server.

I first used a UITextView, but I could see the text but there was a lot of encoding and strange c

相关标签:
2条回答
  • 2020-12-21 06:02

    If you have added the .rtf into the application then try this

    NSString *filePath = [[NSBundle mainBundle] pathForAuxiliaryExecutable:@"<filename.extenssion>"];
    NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:filePath];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:fileURL];
    [webView loadRequest:requestObj];
    
    0 讨论(0)
  • 2020-12-21 06:08

    Can you try this?

    NSURL *url = <create NSURL object pointing to your file>;
    NSURLRequest *req = [NSURLRequest requestWithURL:url];
    [webView loadRequest:req];
    
    0 讨论(0)
提交回复
热议问题