@@ -22,6 +22,22 @@ A TextFieldEffects object is a control that displays editable text and contains
2222*/
2323public class TextFieldEffects : UITextField {
2424
25+ /**
26+ The type of animatino a TextFieldEffect can perform.
27+
28+ - TextEntry: animation that takes effect when the textfield has focus.
29+ - TextDisplay: animation that takes effect when the textfield loses focus.
30+ */
31+ public enum AnimationType : Int {
32+ case TextEntry
33+ case TextDisplay
34+ }
35+
36+ /**
37+ Closure executed when an animation has been completed.
38+ */
39+ public typealias AnimationCompletionHandler = ( type: AnimationType ) -> ( )
40+
2541 /**
2642 UILabel that holds all the placeholder information
2743 */
@@ -41,6 +57,11 @@ public class TextFieldEffects : UITextField {
4157 fatalError ( " \( #function) must be overridden " )
4258 }
4359
60+ /**
61+ The animation completion handler is the best place to be notified when the text field animation has ended.
62+ */
63+ public var animationCompletionHandler : AnimationCompletionHandler ?
64+
4465 /**
4566 Draws the receiver’s image within the passed-in rectangle.
4667
@@ -78,9 +99,9 @@ public class TextFieldEffects : UITextField {
7899
79100 override public func willMoveToSuperview( newSuperview: UIView ! ) {
80101 if newSuperview != nil {
81- NSNotificationCenter . defaultCenter ( ) . addObserver ( self , selector: #selector( TextFieldEffects . textFieldDidEndEditing) , name: UITextFieldTextDidEndEditingNotification, object: self )
102+ NSNotificationCenter . defaultCenter ( ) . addObserver ( self , selector: #selector( textFieldDidEndEditing) , name: UITextFieldTextDidEndEditingNotification, object: self )
82103
83- NSNotificationCenter . defaultCenter ( ) . addObserver ( self , selector: #selector( TextFieldEffects . textFieldDidBeginEditing) , name: UITextFieldTextDidBeginEditingNotification, object: self )
104+ NSNotificationCenter . defaultCenter ( ) . addObserver ( self , selector: #selector( textFieldDidBeginEditing) , name: UITextFieldTextDidBeginEditingNotification, object: self )
84105 } else {
85106 NSNotificationCenter . defaultCenter ( ) . removeObserver ( self )
86107 }
0 commit comments