0

i am new to ios so excuse me if i write something wrong First as appear in .m file i read file and append some code its work fine and display data as expected except in one ,

it convert html tags to (& lt ;) but without space

this make my web view why that happen

.h file

@interface FullReport : UIViewController<UIWebViewDelegate > @property (weak, nonatomic) IBOutlet UIWebView *web; 

.m file

- (void)viewDidLoad { //read FilePath NSString * myPath= [[NSBundle mainBundle] pathForResource:@"content" ofType:@"txt"]; // read file content html code NSString *fileContent = [[NSString alloc]initWithContentsOfFile:myPath encoding:NSUTF8StringEncoding error:nil]; // append some code to it fileContent = [fileContent stringByAppendingString:reportBody]; NSLog(@"content file %@",fileContent); // laod it into my UIWebView [web loadHTMLString:fileContent baseURL:[NSURL fileURLWithPath:myPath]]; [super viewDidLoad]; } 

enter image description here enter image description here

2
  • 2
    Please check for wrong opening or missing tags like <body> and <html> Commented Sep 24, 2014 at 13:10
  • i have this project in android , and its work there fine , we get from same source , so i think that is not the problem Commented Sep 24, 2014 at 13:15

1 Answer 1

1
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:<filepath>]]]; 

here filepath is the path of the file content stored.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.