2021. 1. 5. 21:17ㆍ아이폰 개발
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.alignment = .left
let attributes: [NSAttributedString.Key : Any] = [
.paragraphStyle: paragraphStyle,
.font: UIFont.systemFont(ofSize: 8.0),
.foregroundColor: UIColor.black.withAlphaComponent(0.4)
]
let attributedString = NSAttributedString(string: place.getName(), attributes: attributes)
let stringRect = CGRect(x: x+7, y: y-6, width: 100, height: 20)
attributedString.draw(in: stringRect)
www.hackingwithswift.com/articles/113/nsattributedstring-by-example
NSAttributedString by example
Format text in a variety of ways with this one useful class.
www.hackingwithswift.com
stackoverflow.com/questions/47982390/uitextfield-attributedplaceholder-color-and-opacity-in-swift-4
UITextField attributedPlaceholder color and opacity in swift 4
I have custom textField which has @IBInspectable property placeHolderColor: UIColor and it works fine. I set it by: attributedPlaceholder = NSAttributedString(string: placeHolder, attributes:[
stackoverflow.com
stackoverflow.com/questions/42498721/drawing-text-over-core-graphics-in-swift-3
Drawing text over Core Graphics in Swift 3
Background: I am drawing on a UIImageView with Core Graphics. I would like to ultimately draw a text string over the core graphics drawing. This (hackingwithswift.com) method i used to draw the te...
stackoverflow.com