user1256477
user1256477

Reputation: 11201

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

Upvotes: 4

Views: 5111

Answers (2)

Manish Agrawal
Manish Agrawal

Reputation: 11037

try using like this

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

Upvotes: 7

Pfitz
Pfitz

Reputation: 7344

The correct call would be loadHTMLString:baseURL:

Upvotes: 5

Related Questions