As you have observed in many applications and websites that when user enters wrong username or password, textfields start shaking. Which indicates that user has entered wrong username or password.
For this you have to add this method in UIUtils and pass UIView as a parameter in it.
Code:
Now call this method when user inputs wrong username or password.
For this you have to add this method in UIUtils and pass UIView as a parameter in it.
Code:
+ (void) addShakeEffectOn:(UIView*) view
{
CAKeyframeAnimation * anim = [ CAKeyframeAnimation animationWithKeyPath:@"transform" ] ;
anim.values = @[
[ NSValue valueWithCATransform3D:CATransform3DMakeTranslation(-5.0f, 0.0f, 0.0f) ],
[ NSValue valueWithCATransform3D:CATransform3DMakeTranslation( 5.0f, 0.0f, 0.0f) ]
] ;
anim.autoreverses = YES ;
anim.repeatCount = 2.0f ;
anim.duration = 0.07f ;
[view.layer addAnimation:anim forKey:nil ] ;
}
Now call this method when user inputs wrong username or password.
0 comments:
Post a Comment