简短:有没有办法从 ios 和 android 打印外观相同的模板?或者至少有一种方法可以使用适当的分页符在 WebKit 中打印 html 表格?
Long: 我的应用程序需要能够打印内容列表。我的第一次尝试是使用 html 创建一个模板,然后从代码中插入内容。系统可以工作,但是当表格超过一页时,WebKit 会完全破坏表格。我知道有一些关于 WebKit 中分页符的问题,但没有一个解决方案有效。
此图像显示使用 Chrome 打印。如您所见,分页很好。
我的代码目前看起来像这样:
<!DOCTYPE html>
<html>
<head>
<style>
tr {
page-break-inside: avoid;
page-break-before: auto;
page-break-after: auto;
width: 100%;
}
html,
body {
font-family: "Trebuchet MS", Helvetica, sans-serif;
padding: 0;
margin: 0;
width: 100%;
}
table {
border-collapse: collapse;
width: 100%;
table-layout: fixed;
page-break-after: auto;
}
th,
td {
border: 0.5px solid black;
border-collapse: collapse;
page-break-after: auto;
}
th {
width: …Run Code Online (Sandbox Code Playgroud)根据在 iOS上实现暗模式,我们需要将 foregroundColor 属性设置为新标签颜色。这是如何使用界面构建器完成的?
我尝试使用“文本颜色”选项并将颜色设置为 Developer->labelColor,但这不起作用。
编辑:由于目前这是不可能的,我使用了这个解决方法:
override func viewDidLoad() {
// Support Dark Mode
if #available(iOS 13.0, *) {
let attributes = NSMutableAttributedString(attributedString: textView.attributedText!)
attributes.addAttribute(.foregroundColor, value: UIColor.label, range: NSRange(location: 0, length: attributes.mutableString.length))
textView.attributedText = attributes
}
}
Run Code Online (Sandbox Code Playgroud) 在 UIButton 上使用新的 SF 符号时,符号在我的 iPhone 8 上似乎失真,而在 iPhone 11 模拟器上一切正常。在 iPhone 8 上,这些符号似乎被水平压扁,使其太高。我做了一个gif来说明这个问题。gif 显示了两个正在转换的屏幕截图。一个来自 8 和一个来自 11:
还有其他人有这个问题吗?这里发生了什么?
编辑:
IB 属性。对于包含视图的边缘,Button 被限制为 all。
编辑 #2:当为符号指定字体并缩放“大”时,符号的大小正确。我试过 SystemFont “标题”。
ios ×3
android ×1
css ×1
html ×1
ios-darkmode ×1
printing ×1
sf-symbols ×1
storyboard ×1
xcode ×1