Slide 15
Slide 15 text
15
override func draw(_ rect: CGRect) {
guard let context = UIGraphicsGetCurrentContext() else { return nil }
var remainRect = rect
var attributedStringRect = self.attributedString.boundingRectCached(
scope: "emblem",
size: remainRect.size,
options: [.usesLineFragmentOrigin, .truncatesLastVisibleLine])
self.attributedString.draw(
with: remainRect,
options: [.usesLineFragmentOrigin, .truncatesLastVisibleLine],
context: nil
)
remainRect.origin.y += attributedStringRect.bounds.height
remainRect.size.height -= attributedStringRect.bounds.height
//
// ཁૉͷ܁Γฦ͢
//
UIGraphicsEndImageContext()
}