I have one page with 4 buttons, it's UIViewController
, and in my application I have 4 folder that inside of each folder I have one html file , I have another webViewController
that I should load this html files inside of that webViewController
, I mean when click on first button load first html , if click second load second html and ....
would you please help me to implement this:
here is my method :
-(void)loadWebView{
NSURL *url = [NSURL fileURLWithPath:[ [ NSBundle mainBundle ] pathForResource:
@"TestName/TestName1/Test1Name1" ofType:@"html" ]];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
}
How can I put address like this to my method
@"TestName/TestName1/Test1Name1"
I mean @"TestName%d/TestName%d/Test%dName" ofType:@"html"
and set action to my button to when click on first button goes to first Folder 1 and load html when click on second button goes to second Folder 1 and load html and so on ...
here is my buttons
- (IBAction)ActionButton1:(id)sender {
NSLog(@"A1");
[self.webViewController loadWebView];
}
- (IBAction)ActionButton2:(id)sender {
NSLog(@"A1");
[self.webViewController loadWebView];
}
. . . .
Thanks in advance!
Edit:
File structure folder
TestName1
TestName1
TestName1.html
Second
TestName2
TestName2
TestName2.html