Reputation: 2014
I have an app with a UIWebView that loads different HTML files depending on the preferred language.
I added several folders in the bundle with folder references named en, fr etc.
In each folder I have an index.html with a button in it which when pressed loads another foo.html.
The point is that the name index.html and foo.html in every folder are the same. And I don't know how to reach the needed index.html from the bundle with folder reference and then web view gets confused with what foo.html to open and the button doesn't work. All HTML files work fine when testing in Safari from server.
Upvotes: 1
Views: 4767
Reputation: 1036
First look here how in this post there are added the files to the project and how they are loaded:
https://stackoverflow.com/a/8436281/687323.
If you are having a different folder for each language, and you can get the name of the folder from code, then you just have to put here:
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html" inDirectory:@"www"]];
,
in the "inDirectory:" parameter, the name of the folder
Upvotes: 2