小编Mar*_*vie的帖子

从html创建nsattributedstring时,ios7字体大小会发生变化

我有一个UITextView,我正在管理一个NSAttributedString,最初通过键盘正常输入.我将属性字符串保存为HTML,看起来很好.当我再次加载它,并将其转换回HTML中的属性字符串时,字体大小似乎发生了变化.

例如,加载时的HTML如下所示:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 21.0px Helvetica; color: #000000; -webkit-text-        stroke: #000000}
span.s1 {font-family: 'Helvetica'; font-weight: normal; font-style: normal; font-size:     21.00pt;     font-kerning: none}
</style>
</head>
<body>
<p class="p1"><span class="s1">There is some text as usual lots of text</span></p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

我转换它并使用以下代码检查属性:

    // convert to attributed string
    NSError *err;
    NSAttributedString *as = [[NSAttributedString alloc] …
Run Code Online (Sandbox Code Playgroud)

html fonts nsattributedstring ios7

14
推荐指数
2
解决办法
8351
查看次数

无法将自定义标题与其他标题功能相结合

我之后调用setContentView()时收到此错误

    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.maintitlebar);
Run Code Online (Sandbox Code Playgroud)

代码在我的类的onCreate()中,它扩展了ListActivity.我的清单XML文件显示了应用程序的默认AppTheme:

     android:theme="@style/AppTheme"
Run Code Online (Sandbox Code Playgroud)

我已将styles.xml更新为:

<resources>
   <style name="AppTheme" parent="android:Theme.Light" >
    <item name="android:windowNoTitle">true</item>
   </style>   
</resources>
Run Code Online (Sandbox Code Playgroud)

这似乎与此错误消息的主要帖子一致.我还清理了构建,但我仍然收到上述错误消息.有谁知道造成冲突的原因是什么?

android

13
推荐指数
3
解决办法
2万
查看次数

标签 统计

android ×1

fonts ×1

html ×1

ios7 ×1

nsattributedstring ×1