Tusker/Tusker/Views/InlineTextAttachment.swift

22 lines
653 B
Swift
Raw Normal View History

2018-09-03 20:54:03 +00:00
//
// InlineTextAttachment.swift
// Tusker
//
// Created by Shadowfacts on 9/3/18.
// Copyright © 2018 Shadowfacts. All rights reserved.
//
import UIKit
class InlineTextAttachment: NSTextAttachment {
var fontDescender: CGFloat!
override func attachmentBounds(for textContainer: NSTextContainer?, proposedLineFragment lineFrag: CGRect, glyphPosition position: CGPoint, characterIndex charIndex: Int) -> CGRect {
var rect = super.attachmentBounds(for: textContainer, proposedLineFragment: lineFrag, glyphPosition: position, characterIndex: charIndex)
rect.origin.y = fontDescender
return rect
}
}