I have an Bundle folder, which consist of one . XML
file and one folder. Which look like this
Here i have read the .XML file using NSXml Parser. The XML will look like,
<?xml version="1.0" standalone="yes"?>
<user id="32" name="lima"><class id="1" name="Third">
<pages id="2" name="Page002.html" url="matematica/Page002.html"/>
</user>
I have read the URL value also, but how i have to give the URL value in the XML file, the Page002.html is inside the matematica folder. How i have to give that path in XML.? I'm loading that .HTML file in UIWebview
. If i give like matematica/Page002.html webview can't find the path.
尝试这个
NSString *path=[[NSBundle mainBundle] pathForResource:@"Page002" ofType:@"html" inDirectory:@"matematica"];
The folder Structure of in the Xcode is just logical grouping its nothing to do with the url . so off course your url is wrong in above case . You have give the full path of inside the url . You can get it by using :
NSString *path=[[NSBundle mainBundle] pathForResource:@"Page002" ofType:@"html"];
then you can load it by :
[WebView loadRequest:[NSURLRequest requestWithURL:[NSUrl urlWithString:path]]]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.