rimesh / notestextview Goto Github PK
View Code? Open in Web Editor NEWiOS Notes style rich text formatting for UITextView using NSAttributedString
iOS Notes style rich text formatting for UITextView using NSAttributedString
Hello, your library looks perfect but, as I noticed, there is no documentation. That's why I want to ask you some questions
I found text lost font size after Bold it. The problem is caused by changeTrait func in makeTextBold.
`
func changeTrait(trait: UIFontDescriptor.SymbolicTraits) {
//....
if let currentFont = initialFont{
var currentTraits = currentFont.fontDescriptor.symbolicTraits
// complement the current traits
let _ = currentTraits.contains(trait) ? currentTraits.remove(trait) : currentTraits.update(with: trait)
if let changedFontDescriptor = currentFont.fontDescriptor.withSymbolicTraits(currentTraits) {
let updatedFont = UIFont(descriptor: changedFontDescriptor , size: 0)
if selectedRange.length != 0{
textStorage.enumerateAttribute(.font, in: selectedRange, options: .longestEffectiveRangeNotRequired) { (_, range, stop) in
textStorage.beginEditing()
textStorage.addAttribute(.font, value: updatedFont, range: range)
textStorage.endEditing()
}
}
typingAttributes[NSAttributedString.Key.font] = updatedFont
updateVisualForKeyboard()
}
}
}
`
Then i fix in it
`
if let currentFont = initialFont{
var currentTraits = currentFont.fontDescriptor.symbolicTraits
// complement the current traits
let _ = currentTraits.contains(trait) ? currentTraits.remove(trait) : currentTraits.update(with: trait)
if let changedFontDescriptor = currentFont.fontDescriptor.withSymbolicTraits(currentTraits) {
// Fix lost font size.
let currentFontSize = currentFont.pointSize
let updatedFont = UIFont(descriptor: changedFontDescriptor , size: currentFontSize)
if selectedRange.length != 0{
textStorage.enumerateAttribute(.font, in: selectedRange, options: .longestEffectiveRangeNotRequired) { (_, range, stop) in
textStorage.beginEditing()
textStorage.addAttribute(.font, value: updatedFont, range: range)
textStorage.endEditing()
}
}
typingAttributes[NSAttributedString.Key.font] = updatedFont
updateVisualForKeyboard()
}
}
`
could you update it ?
Can you add support for ordered lists and unordered lists like Default Notes App and a custom color picker for text and text background with custom font selection? Also, add a requirements section with a minimum deployment target(currently iOS 13.0 and above but if can you provide support from iOS 11.0?)
Hello, is it possible to install it with cocoa pods? I don't know any other ways
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.