iOS源碼下載:對(duì)輸入的字用動(dòng)畫畫出來
作者:佚名
對(duì)輸入的字用動(dòng)畫畫出來,附源碼下載。實(shí)現(xiàn)對(duì)字符串的畫線動(dòng)畫,可以在類方法中修改動(dòng)畫大小和位置,以及畫線的顏色。
功能分類:特效
支持平臺(tái):iOS
運(yùn)行環(huán)境:iOS
開發(fā)語言:Object-c
開發(fā)工具:Xcode
源碼大小:174.88KB
源碼下載地址:http://down.51cto.com/data/1975235
源碼簡(jiǎn)介
實(shí)現(xiàn)對(duì)字符串的畫線動(dòng)畫,可以在類方法中修改動(dòng)畫大小和位置,以及畫線的顏色。
源碼運(yùn)行截圖
效果圖
源碼片段
- -(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);
- }
責(zé)任編輯:閆佳明
來源:
網(wǎng)絡(luò)整理