Search code examples
iphoneobjective-cuiwebview

Center Image in UIWebView


Does anybody know a possibility to center simple pictures within a UIWebview without using hmtl/css? Thanks in Advance.


Solution

  • This is not possible -- a UIWebView displays web content, nothing else. Use a UIImageView if you need to display images in your application.

    Edit: Noah's comment had me look further into this, and it is possible to load local files using the loadData:MIMEType:textEncodingName:baseURL:, but I'm not sure what the centering situation is there. loadHTMLString:baseURL: is the easiest way to get this functionality, but of course you were asking how to do it without html/css.