iOS源碼下載:對輸入的字用動畫畫出來
作者:佚名
對輸入的字用動畫畫出來,附源碼下載。實現對字符串的畫線動畫,可以在類方法中修改動畫大小和位置,以及畫線的顏色。
功能分類:特效
支持平臺: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);
- }
責任編輯:閆佳明
來源:
網絡整理