Tuesday, August 24, 2010

How to Show Text Left and Right in UIWebView

When you need to show text on same line at left and right in UIWebView, this is one way:
NSString *myHtml = [NSString stringWithFormat:
    @"<html><body>"
    "<span style='float:left'>%@</span>"
    "<span style='float:right'>%@</span>"
    @"</body></html>",
    @"I'm left", @"I'm right"];
   
[self.cellWebView loadHTMLString:myHtml baseURL:nil];
Can't use div, since it seems to force a linebreak by default.

No comments:

Post a Comment