如何在ST Attributed TextView中将文本与中心对齐

时间:2013-07-15 09:12:54

标签: objective-c nsstring text-alignment

我正在使用DTAttributedTextView以nsstring格式显示html数据。有没有办法将此视图中的文本与中心对齐。

1 个答案:

答案 0 :(得分:0)

我认为可以这样做&将代码添加到其中 -

  NSMutableString *html = [[NSMutableString alloc] initWithCapacity:1];
        [html appendString:@"<html><head>"];
        [html appendString:@"<style type=\"text/css\">"];
        [html appendString:@"body {"];
     [html appendString:@"<center>"];
        [html appendString:@"background-color: transparent;"];
        [html appendString:@"color: white;"];
        [html appendString:@"}"];
     [html appendString:@"<center>"];
        [html appendString:@"</style>"];
[html appendString:@"</head>"];
      [html appendString:@"</body></html>"];