Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adding html text to my UIWebView

I want to add text from my database to a UIWebView, but I have an error I can't deal with.

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 the .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 get:

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

why is this happening? Thank you in advance

like image 998
user1256477 Avatar asked Dec 15 '22 22:12

user1256477


1 Answers

try using like this

NSString *html = @"Should be halfI wish the answer were just 42";
[webView loadHTMLString:html baseURL:nil];

like image 164
Manish Agrawal Avatar answered Dec 27 '22 15:12

Manish Agrawal