Objective C: Show online image on iPhone
By default the UIImageView control from the iPhone sdk does not allow us to load images from a specific url. In this case we do a little tryck and use a UIWebView.
- (void)loadImage:(NSString*)url frame:(CGRect)frame { NSString* textHTML = @" <!-- body { background-color: transparent; color: white; } --> <img src="\" alt="" width="%0.0f" height="%0.0f" /> "; NSString* html = [NSString stringWithFormat:textHTML, url, frame.size.width, frame.size.height]; if(webView == nil) { webView = [[UIWebView alloc] initWithFrame:frame]; [self.view addSubview:webView]; } [webView loadHTMLString:html baseURL:nil]; }