开发者

move or center webview content

how could I center or move content loaded on a web开发者_运维知识库view object programatically??


You would typically use CSS styles to center or position your content. Refer to the Safari CSS Reference and read about the position, top, left, and text-align properties.

To change CSS styles programmatically at runtime from your Objective C code, use -[UIWebView stringByEvaluatingJavaScriptFromString:]. You can pack as much javascript into that string as you need to, but it would be best if you can define some javascript functions in your webview that position the elements based on parameters you pass in from Objective C.


Javascript? sounds new for me, thought that some direct method could easily do that. Is this unique way to do it? I apreciate so much your post, let's start reading safari css reference! If somebody knows any direct method please post it!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜