Add CHANGELOG entry and end image context

This commit is contained in:
Steven Deutsch
2017-11-10 20:48:35 -06:00
parent f1e5b31eae
commit 89f8993cae
2 changed files with 6 additions and 2 deletions
+3 -2
View File
@@ -89,7 +89,8 @@ open class AvatarView: UIView {
if width == 0 || height == 0 {return UIImage()}
var font = placeholderFont
_ = UIGraphicsBeginImageContextWithOptions(CGSize(width: width, height: height), false, UIScreen.main.scale)
_ = UIGraphicsBeginImageContextWithOptions(CGSize(width: width, height: height), false, UIScreen.main.scale)
defer { UIGraphicsEndImageContext() }
let context = UIGraphicsGetCurrentContext()!
//// Text Drawing
@@ -102,7 +103,7 @@ open class AvatarView: UIView {
let textStyle = NSMutableParagraphStyle()
textStyle.alignment = .center
let textFontAttributes: [NSAttributedStringKey: Any] = [NSAttributedStringKey.font: font, NSAttributedStringKey.foregroundColor: placeholderTextColor, NSAttributedStringKey.paragraphStyle: textStyle]
let textFontAttributes: [NSAttributedStringKey: Any] = [NSAttributedStringKey.font: font, NSAttributedStringKey.foregroundColor: placeholderTextColor, NSAttributedStringKey.paragraphStyle: textStyle]
let textTextHeight: CGFloat = initals.boundingRect(with: CGSize(width: textRect.width, height: CGFloat.infinity), options: .usesLineFragmentOrigin, attributes: textFontAttributes, context: nil).height
context.saveGState()