I have a NotificationVC containing table view having 10 cells index 0 to 9. on click of each cell NotificationWebVC should open up that has a UIWebView that loads diff. html depending upon which cell is selected in NotificationVC. Right now my code works only for index=0 , but not for other indexes , seems bit weird.
NotificationWebVC
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:_resourceName ofType:@"html" inDirectory:nil] ;
NSURL *url = [NSURL fileURLWithPath:htmlFile];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[_webView loadRequest:request];
_webView.delegate=(id)self;
}
Please suggest. _resourceName is a property having the name of html file.
then in viewDidload add the following code
First you need to make an array containing your 10 urls. Then when a user tap on each cell, use the didSelectRowAtIndexPath delegate method.
Add line of code to NotificationWebVC.h
then in .m class synthise it
after this go to didSelectMethod of tablevew datasouce in NotificationVC.m there you add the following code
After doing all this now you shift to NotificationWebVC.m add the following code to in viewDidLoad method
after doing all this pl z be sure to add all 10 HTML file in your project and try to check that you are getting correct html file on select in table from
be sure you are passing correct name of file in responsString
or better put
to it check it.
i think this code will help you
try this code