Text Fade UITextField

I want the text to fade in the uitext field when I change it. I tried

[UIView animateWithDuration:0.25 animations:{ textview.text = @""; }]; 

but it didn’t work. It would be easier if I could access the UILabel text fields, but I don't know them!

Oh, and btw, I want the text to be NOT the whole field faded

Any help is appreciated! - JomanJi

+3
source share
3 answers

You need to set the alpha "textview" to the value you want to extrude in order to:

 [UIView animateWithDuration:0.25 animations:{ textview.alpha = 0; }]; 

UPDATE:

The text box itself is not available. The "textColor" property is not animated, so this is also not the case. It’s best to separate the graphic style from the label and place it in a separate view behind the label. This way you can wipe the label without deleting the border and color of the BG, or, nevertheless, you have a label in style.

+1
source

Try something like this:

 CATransition *transition = [CATransition animation]; transition.duration = 0.15; transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; transition.type = kCATransitionFade; [textField.layer addAnimation:transition forKey:nil]; textField.text = @"some new text"; // or nil 

It works not only with text fields. I used it with UIImageView

+4
source

If you want a large set of common classes and extensions, which includes a UIView extension with the functions fadeIn () and fadeOut (), refer to the SwifterSwift module

http://swifterswift.com/docs/Extensions/UIView.html

Pull out the coconut:

 pod 'SwifterSwift' 

Then you can use something like:

 textview.fadeIn() 
0
source

Source: https://habr.com/ru/post/1207181/


All Articles