Skip to content

Commit 8693182

Browse files
author
Raul Riera
committed
Quick fix for the iOS 11 problem
1 parent 40b037f commit 8693182

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

TextFieldEffects/TextFieldEffects/TextFieldEffects.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,13 @@ open class TextFieldEffects : UITextField {
7777
// MARK: - Overrides
7878

7979
override open func draw(_ rect: CGRect) {
80-
drawViewsForRect(rect)
80+
// FIXME: Short-circuit if the view is currently selected. iOS 11 introduced
81+
// a setNeedsDisplay when you focus on a textfield, calling this method again
82+
// and messing up some of the effects due to the logic contained inside these
83+
// methods.
84+
// This is just a "quick fix", something better needs to come along.
85+
guard isFirstResponder == false else { return }
86+
drawViewsForRect(rect)
8187
}
8288

8389
override open func drawPlaceholder(in rect: CGRect) {

0 commit comments

Comments
 (0)