     public var numberOfLines: Int = 1 {
         didSet {
             textContainer.maximumNumberOfLines = numberOfLines
+            invalidateDisplayAndLayout()
         }
     }
     

        } 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 clear() {
        textStorage.deleteCharactersInRange(NSRange(location: 0, length: textStorage.length))
        invalidateDisplayAndLayout()
    }
    
    private func setAttributedStringForString(string: NSString) {
