如何在Webview中放置文字?

| 我有这种4段。 像这样: 我今天站在这里,对我们面前的任务感到谦卑,感谢您给予的信任,铭记我们祖先的牺牲。我感谢布什总统对我们国家的服务,以及他在整个过渡过程中表现出的慷慨与合作。 我想在使用webview的不同视图中使用此段落。 我的意思是我想在UIWebview中显示这样的段落 谁能告诉我该怎么做?     
已邀请:
        如果确实必须在UIWebview中显示Text,请实现一个实现UIWebView委托协议的类,如下所示:
@interface Web : UIViewController <UIWebViewDelegate> {
    UIWebView *webView;
    NSString *uRLString;

}

@property (nonatomic, retain) IBOutlet UIWebView *webView;
@property (nonatomic, retain) NSString *uRLString;
在您的.m文件中,您可以在viewDidLoad中设置委托和视图,如下所示:
self.view = webView.view;
self.webView.delegate = self;
并像这样实现openURL:
- (void)openURL:(NSString *)urlString
{
[myWebView loadHTMLString: <your static string in html-formate>]

}
但是就像我之前说过的:您应该使用UITextView来遵循Apple准则,并且还可以在没有IB的情况下设置UITextView的首选项。实际上,您实际上从未使用过IB。     
        
[webView1 loadHTMLString:@\"Welcome to StackOverFlow\" baseURL:nil];  
    
        
[myWebView loadHTMLString:@\"<p>I stand here today humbled by the task before us, grateful for the trust you have bestowed, mindful of the sacrifices borne by our ancestors. I thank President Bush for his service to our nation, as well as the generosity and cooperation he has shown throughout this transition</p>\"]
    

要回复问题请先登录注册