UITextView – can't set underline or strikethrough attributes on text?
Your underline style is invalid. Change this line:
let underlineAttribute =
[NSAttributedStringKey.underlineStyle: NSUnderlineStyle.styleSingle]
to this:
let underlineAttribute =
[NSAttributedStringKey.underlineStyle: NSUnderlineStyle.styleSingle.rawValue]
Result:
Swift save the text of UITextView in file with attributes
Try using :
textView.attributedText
to retreive the text content with its formatting attributes.
text underline a different color than the text color in iOS
You can set two UITextViews with the same text and different colors on top of each other, with the textview underneath underlined.
text underline a different color than the text color in iOS
You can set two UITextViews with the same text and different colors on top of each other, with the textview underneath underlined.
Format text in UITextView
First keep text property of textView
as 'Attributed
', after that just select the text and change it's style and font as you want.
P.S. - All you have to do this in Attribute inspector panel of IB.
EDIT:
For more, visit this link .
Also, this is very good mainly when the textField
have a text that will not change, e.g. - like About info. And when this text is inserted in IB directly instead of assigning text programmaticaly.
Related Topics
Uibarbuttonitem Changing Title Not Working
Uitabbar Change Background Color of One UItabbaritem on iOS7
How to Detect If The HTML5 Autoplay Attribute Is Supported
Hls Video Streaming on iOS/Safari
How to Handle a File Sent with 'Open In...' from Another App to My Own iOS App
iOS Swift Streaming App Does Not Play Music in Background Mode
How to Change Select Box Background Without Losing The Right Arrow on Mobile Safari
Swiftui: Navigate to Home Screen After Login Completed. Navigating Views by Button Click
Passing Arguments to @Selector Method
Box Shadow Spread Bug in Webkit in iOS 7 on Retina Ipads
How to Use Third Party Lib in Embedded Dynamic Framework for iOS with Swift
Receive Signal from Beacon While App Is in the Background
Hkanchoredobjectquery Not Returning Reliably in Background
How to Make One Side of a Div Pointy with CSS
Revealviewcontroller() Always Returns Nil
Nsurlprotocol Isn't Asked to Load After Yes Response to Caninitwithrequest
Media_Err_Decode on HTML5 Video in iOS UIwebview After Many Plays