     
     private func clear() {
         textStorage.deleteCharactersInRange(NSRange(location: 0, length: textStorage.length))
-        setNeedsDisplay()
+        invalidateDisplayAndLayout()
     }
     
     private func setAttributedStringForString(string: NSString) {

        } else {
            textStorage.removeAttribute(key, range: range)
        }
        setNeedsDisplay()
    }
    
    // MARK: Drawing
    
    public override func drawRect(rect: CGRect) {
        textContainer.size = bounds.size
        let glyphRange = layoutManager.glyphRangeForTextContainer(textContainer)
        layoutManager.drawBackgroundForGlyphRange(glyphRange, atPoint: bounds.origin)
        layoutManager.drawGlyphsForGlyphRange(glyphRange, atPoint: bounds.origin)
    }
}

    
    private func setAttributedString(attrString: NSAttributedString) {
        textStorage.setAttributedString(attrString)
        invalidateDisplayAndLayout()
    }
    
    private func applyAttributeWithKey(key: NSString, value: AnyObject?) {
