0

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

4

1 回答 1

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>"];
于 2013-07-15T09:25:34.173 回答