views:

39

answers:

2

Hello, how could I center or move content loaded on a webview object programatically??

A: 

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.

cduhn
A: 

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!

Ruthy