這裡講述的是IOS之UITextField輸出錯誤的震動動畫的闡明,詳細操作請看面的內容
//左右震動效果- (void)shake:(UIView *)view {CGRect frame = view.frame;CAKeyframeAnimation *shakeAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];CGMutablePathRef shakePath = CGPathCreateMutable();CGPathMoveToPoint(shakePath, NULL, frame.origin.x+frame.size.width/2, frame.origin.y+frame.size.height/2);int index;for (index = 3; index >=0; --index) {CGPathAddL.netoPoint(shakePath, NULL, frame.origin.x+frame.size.width/2 - frame.size.width * 0.02f * index, frame.origin.y+frame.size.height/2);CGPathAddL.netoPoint(shakePath, NULL, frame.origin.x+frame.size.width/2 + frame.size.width * 0.02f * index, frame.origin.y+frame.size.height/2);}CGPathCloseSubpath(shakePath);shakeAnimation.path = shakePath;shakeAnimation.duration = 0.5f;shakeAnimation.removedOnCompletion = YES;[view.layer addAnimation:shakeAnimation forKey:nil];CFRelease(shakePath);}
多多關注本站,我們將為您搜集更多的Android開發相關文章.
【iOS之UITextField輸出錯誤的震動動畫】的相關資料介紹到這裡,希望對您有所幫助! 提示:不會對讀者因本文所帶來的任何損失負責。如果您支持就請把本站添加至收藏夾哦!