Reputation: 1883
I have this kind of 4 paragraphs.
like this:
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.
I want to use this paragraphs in different views using webview.
I mean I want to show such paragraphs in UIWebview
can anyone please tell me how to do this?
Upvotes: 4
Views: 11051
Reputation: 679
If you really have to show the Text in an UIWebview implement a class which implements the UIWebView Delegate protocoll, like this:
@interface Web : UIViewController <UIWebViewDelegate> {
UIWebView *webView;
NSString *uRLString;
}
@property (nonatomic, retain) IBOutlet UIWebView *webView;
@property (nonatomic, retain) NSString *uRLString;
in your .m file you set the delegate and the view in your viewDidLoad like this:
self.view = webView.view;
self.webView.delegate = self;
and implement the openURL like this:
- (void)openURL:(NSString *)urlString
{
[myWebView loadHTMLString: <your static string in html-formate>]
}
But like I said before: You should use an UITextView to stick to Apple guidelines and you can also set preferences of UITextView without IB. In fact you really never HAVE to use the IB.
Upvotes: 4
Reputation: 11546
[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>"]
Upvotes: 6