iphone - 将 html 文本添加到我的 UIWebView

标签 iphone objective-c ios uiwebview

我想将我的数据库中的文本添加到 UIWebView,但出现无法处理的错误。

在我的 .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

在 .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];
}

我得到的错误:

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

为什么会这样?提前谢谢你

最佳答案

尝试这样使用

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

关于iphone - 将 html 文本添加到我的 UIWebView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11257703/

相关文章:

objective-c - 为什么应用程序没有在 iOS 8 中注册推送通知?

objective-c - UIView动画随机

ios - AVPlayer 设置 fps

iphone - 是否可以选择在 PayPal 的 iPhone 框架中启用定期付款?

iphone - 将 UIView 保留在 Circle Objective-C 中

iphone - NSXMLParser 委托(delegate)处理属性

iphone - 如何在 Xcode 3.2 和 iOS 4.2 设备中运行和部署 Xcode 4.2 项目

iphone - 获取 UITableViewCell 上的 UITextField 的引用?

ios - UITextView.attributedText,如何设置numberOflines和lineBreakMode?

ios - 使用 swift 2.0 代码 Xcode 7.1 IOS 9.1 播放嵌入式声音