iOS:MFMailCompseViewController的复杂HTML / CSS

时间:2014-05-06 15:31:01

标签: html ios objective-c mfmailcomposeviewcontroller

我已经搜索了一下,但无法找到足够的回复,所以请原谅我,如果已经问过这个问题。

我想在我的MFMailCompseViewController中做一个格式精美/样式化的电子邮件。是否只需要使用非常长的HTML表单进行[NSString stringWithFormat...],并在头顶上编写CSS?有什么效果吗?

[NSString stringWithFormat:@"<!doctype html> <html> <head> <style type="text/css">
  body {
    color: white;
    background-color: #414042 }
  .p {

    color: #111111;
    text-size: 2em; }
  </style>
  </head>
  <body>
  <h1>This is my beautiful header </h1>
  <p>This is my beautiful paragraph </p>
  </body>
  </html>" ];

显然这是一个荒谬的例子,但这可能是这样吗?甚至可能添加字体之类的东西?

谢谢!

1 个答案:

答案 0 :(得分:1)

是的,这是允许的。

要确保正确识别HTML,请致电

设置带有- (void)setMessageBody:(NSString*)body isHTML:(BOOL)isHTML的消息体作为第二个参数时,

YES。就这么简单。