4

I am using a local html file to load a content with images using UIWebview.I have added all the images in the Image.xcassests. How do we link images in Image.xcassests in the local html page to show up

.menu {
    background: url("menu") no-repeat center center;
    background-size: 100% 100%;
    height: 16px;
    width: 26px;
} Menu is the name of the image assest i wish to use

I tried the following codes , images are not showing up

    NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"welcome" ofType:@"html"];
    NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
   [htmlWebView loadHTMLString:htmlString baseURL:[[NSBundle mainBundle] bundleURL]];

Also 
   NSURL *url = [[NSBundle mainBundle] URLForResource:@"welcome" withExtension:@"html"];
   NSURLRequest* request = [NSURLRequest requestWithURL:url];
   [ htmlWebView loadRequest:request];
Nassif
  • 1,113
  • 2
  • 14
  • 34

0 Answers0