I a trying to view an .html file (index.html) that is stored in my Bundle (in my Supporting Files).
The .html file sits in a folder called HTML. My code is as follows:
- (void)viewDidLoad
{
[super viewDidLoad];
_viewWeb.delegate = self;
NSString *path = [[NSBundle mainBundle]
pathForResource:@"index" ofType:@"html" inDirectory:@"HTML"];
NSURL *url = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[_viewWeb setScalesPageToFit:YES];
[self.viewWeb loadRequest:request];
}
My header file looks as follows:
@interface D6ViewController : UIViewController <UIWebViewDelegate>
{
IBOutlet UIWebView *viewWeb;
}
@property (weak, nonatomic) IBOutlet UIWebView *viewWeb;
@end
I synthesized property as viewWeb = _viewWeb
. The viewcontroller holding the UIWebView loads fine but shows a white screen with no webpage. I have set the outlets in the IB.
Any ideas? Thanks,