功能分类:特效
支持平台:iOS
运行环境:iOS
开发语言:Object-c
开发工具:Xcode
源码大小:174.88KB
源码下载地址:http://down.51cto.com/data/1975235
源码简介
实现对字符串的画线动画,可以在类方法中修改动画大小和位置,以及画线的颜色。
源码运行截图
效果图
源码片段
- -(void)startDraw:(UIButton*)sender
- {
- for (id layer in self.view.layer.sublayers) {
- if([layer isKindOfClass:[ZYAnimationLayer class]])
- {
- [layer removeFromSuperlayer];
- }
- }
- [ZYAnimationLayer createAnimationLayerWithString:self.myTextField.text andRect: CGRectMake(20.0f, -100.0f,
- CGRectGetWidth(self.view.layer.bounds) - 40.0f,
- CGRectGetHeight(self.view.layer.bounds) - 84.0f) andView:self.view andFont:CTFontCreateWithName(CFSTR("Helvetica-Bold"), 80.0f, NULL) andStrokeColor:[UIColor colorWithRed:0.3 green:0.2 blue:0.5 alpha:1]];
- }
- - (void)textFieldDidBeginEditing:(UITextField *)textField
- {
- self.myTextField.frame = CGRectMake(self.myTextField.frame.origin.x, self.myTextField.frame.origin.y - 252, self.myTextField.frame.size.width, self.myTextField.frame.size.height);
- }
- - (void)textFieldDidEndEditing:(UITextField *)textField
- {
- self.myTextField.frame = CGRectMake(self.myTextField.frame.origin.x, self.myTextField.frame.origin.y + 252, self.myTextField.frame.size.width, self.myTextField.frame.size.height);
- }