 |
 |
Using an image in my bundle in a WebView...
|
 |
|
 |
|
Grizzled Veteran
Join Date: Jun 2002
Status:
Offline
|
|
Hey guys,
I'm having a problem with getting a image from my .app to display in my WebView.
Here is what I use trying to get it to display:
Code:
NSString *image = [[NSBundle mainBundle] pathForResource:@"CodeHelpBrowser" ofType:@"png"];
NSLog(@"%@",image);
NSString *html = [NSString stringWithFormat:@"<img src=\"%@\" alt=\"Code Help Browser\" width=\"269\" height=\"150\" />", image];
[[helpWebView mainFrame] loadHTMLString:html baseURL:[NSURL URLWithString:@"about:blank"]];
The NSLog outputs the correct path:
2004-05-28 19:36:27.575 Tag[1982] /Volumes/Home/Users/olivercameron/Projects/Builds/Tag.app/Contents/Resources/CodeHelpBrowser.png
But, the image just displays as an X in my WebView. Any ideas appreciated,
Oliver
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: May 2001
Location: Cupertino, CA
Status:
Offline
|
|
Just a guess, but have you tried appending file:// to the front of the image path?
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Jun 2002
Status:
Offline
|
|
Originally posted by itai195:
Just a guess, but have you tried appending file:// to the front of the image path?
That worked, thanks
Oliver
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: May 2001
Location: Cupertino, CA
Status:
Offline
|
|
No prob. I'm doing my first experimentation with WebViews these days. Being a little annoyed that I can't seem to easily get a border drawn around it...
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Jun 2002
Status:
Offline
|
|
Originally posted by itai195:
No prob. I'm doing my first experimentation with WebViews these days. Being a little annoyed that I can't seem to easily get a border drawn around it...
I had the same problem with a border, at first I subclassed it and drew the border myself. But then it didn't work too good, I gave up and used a NSBox subclass  with custom color. If you want how to change its color, I'll post the code.
Thanks,
Oliver
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: May 2001
Location: Cupertino, CA
Status:
Offline
|
|
Thanks Oliver, I got it working fine in an NSBox.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|