开发者

loading image to UIWebView in Xcode

I'm trying to make 1 page view to load and image from certa开发者_JS百科in link, I've manage to do that, but the picture didn't fit all the view, I'm planning it to cover the whole view, but it only cover around 80% of it, which mean it still floating in the left side. Is there any code or attribute I need to define to make the page being stretch to fit the whole view?

Thanx in advance.


i think the right approach to this would be adding some css-style to your image (if you can manipulate your html) so that you can control its size and placement...

EDIT: if you set your UIWebView to directly load an image, you could try (I don't know if it is acceptable for you) to wrap the image in a HTML snippet like this:

<html><head>...</head><body><img src=YOU_URL_HERE /><body></html>

so that you can control its size and position through CSS...


You could set a custom meta viewport for your site.

iPhone viewport dimensions
The viewport is the rectangle area that determines how content is laid out and where text wraps on a webpage. On the desktop, the viewport is determined by the size of the window. The user resizes the viewport by resizing the window and scrolls to see more of the webpage. Safari on iPhone doesn't have windows — there are no scroll bars or resize knobs. Therefore, the "window" is a fixed size determined by the iPhone screen size. The user pans to see more of the webpage, and can also zoom in and out using double tap or the pinch gesture. To make this work on iPhone, the viewport has a scale and width property. When Safari first loads a webpage, it sets the initial scale to fit the webpage completely width-wise on the iPhone screen. [...]

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜