cost 273 ms
如何使用 AttributedStrings 顯示差異 UI

[英]How to display a diff UI with AttributedStrings

我正在研究一項將新輸入與舊輸入進行比較的功能。 我希望它看起來像在 bitbucket 或 github 等中看到的 git diff。 我目前有一個字符數組,其前綴是添加還是刪除。 現在我堅持用不同的背景顏色顯示每個字符串,同時保持一些正常的類似句子的結構。 下面的代碼只是在新行上創建了一個新的 ...

如何在不轉換為 NSAttributedString 的情況下將所有屬性從一個 AttributedString 復制到另一個?

[英]How to copy all attributes from one AttributedString to another without converting to NSAttributedString?

我有一個 AttributedString,其中包含一組我直到運行時才知道的屬性。 現在我想 append / 加上另一個字符串。 如何使附加字符串具有與原始 AttributedString 相同的屬性? 從第一個字符復制屬性沒問題,因為整個 AttributedString 具有同類屬性。 我 ...

Swift 5 中的 NSAttributedString 發生了什么? 粗體不起作用?

[英]What Happened to NSAttributedString in Swift 5? Bold Doesnt work?

我遇到的所有示例代碼都不再適用於粗體標簽。 這也包括斜體 html 標簽。 我正在使用來自 hacking swift 的代碼作為字符串擴展。 然后嘗試 代碼看起來是正確的。 只是粗體標簽沒有被渲染。 有人知道解決方法嗎? 我嘗試添加 html 樣式系統硬編碼字體技巧,但效果不佳。 我嘗試了 ma ...

在 Xamarin Forms iOS 中使用 UIStringAttributes 時,如何獲取 UITextView 的行高?

[英]How do I get line heights of UITextView when using UIStringAttributes in Xamarin Forms iOS?

我在設置UIStringAttributes.Font時遇到問題。 在設置之前,系統默認為Helvetica 12pt ,行高為 13.8。 此行高似乎准確,如下圖所示: 但是,如果我使用Arial 17pt設置UIStringAttributes.Font屬性,則 18.99 的行高似乎不准 ...

如何在 SwiftUI 中同時檢測鏈接上的點擊和點擊坐標?

[英]How to detect a tap on a link and tap coordinates at the same time in SwiftUI?

在我的 SwiftUI 應用程序中,文本的某些部分需要可點擊。 在點擊時,應該發生一些自定義操作,不一定打開 web 頁面。 同時我需要檢測水龍頭坐標。 我打算為此使用拖動手勢處理程序。 我使用AttributedString將可點擊文本實現為鏈接。 問題是我無法檢測到點擊坐標,因為點擊鏈接時不會 ...


排序:
質量:
 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM