Adding html text to my UIWebView

I want to add text from my database to UIWebView, but I have an error that I cannot handle.

in my .h:

#import <UIKit/UIKit.h> @interface readNotice : UIViewController { IBOutlet UILabel *message; IBOutlet UIWebView *body; } @property(nonatomic, retain)IBOutlet UILabel *message; @property(nonatomic, retain)IBOutlet UIWebView *body; -(void)getNoticeData:(NSString *)noticeID:(NSString *)noticeTitle; @end 

In .m:

 @synthesize message,body; -(void)getNoticeData:(NSString *)noticeID:(NSString *)noticeTitle { //some taks not useful for this code NSString *bodyText = [dict objectForKey:@"introtext"]; [body loadHTMLString: bodyText]; } 

The error I am getting is:

 No visible @interface for 'UIWebView' declares the selector 'loadHTMLString:' 

Why is this happening? Thank you in advance

+4
source share
2 answers

The correct call would be loadHTMLString:baseURL:

+5
source

try using like this

NSString * html = @ "There should be half if the answer was only 42",
[webView loadHTMLString: html baseURL: nil];

+7
source

All Articles