开发者

Parse XML and generate UI in UIWebView iPad App

开发者 https://www.devze.com 2023-02-18 23:51 出处:网络
I will receive an XML from Server, and have to parse the xml file, and based on that have to pop开发者_开发知识库ulate textbox, listbox etc(a form) in UIWebView.

I will receive an XML from Server, and have to parse the xml file, and based on that have to pop开发者_开发知识库ulate textbox, listbox etc(a form) in UIWebView.

I know XML parsing for iOS using NSXML, I do not know how to fire events to generate Form/UI at runtime.

Any tutorials or idea pls.


If you have created your HTML as a NSString already, you can load it into the UIWebView by using the method loadHTMLString:baseURL:. For example:

NSString *htmlString = [[NSString alloc] init];
//Download XML, parse it and turn it into HTML.
[myWebView loadHTMLString:htmlString baseURL:nil];
//if you have to do any thing else to the HTML string do it here
[htmlString release];

Changing the htmlString after calling loadHTMLString:baseURL: won't update the UIWebView. You will need to call the method again, sending the modified string.

If you need further help, comment below and I'll edit my answer or comment back.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号