iOS字體抖動動畫的實(shí)現(xiàn)代碼
本文實(shí)例為大家分享了iOS字體抖動的具體實(shí)現(xiàn)代碼,供大家參考,具體內(nèi)容如下
一、效果圖

二、代碼
ViewController.m
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIButton *button=[UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame=CGRectMake(10, 100, 100, 200);
button.backgroundColor=[UIColor redColor];
[button setTitle:@"按鈕" forState:UIControlStateNormal];
[self.view addSubview:button];
//按鈕的動畫效果
[self buttonAnimation:button];
}
//按鈕出現(xiàn)的時候有一個動畫效果
- (void)buttonAnimation:(UIButton *)sender
{
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
CATransform3D scale1 = CATransform3DMakeScale(0.5, 0.5, 1);
CATransform3D scale2 = CATransform3DMakeScale(1.2, 1.2, 1);
CATransform3D scale3 = CATransform3DMakeScale(0.9, 0.9, 1);
CATransform3D scale4 = CATransform3DMakeScale(1.0, 1.0, 1);
NSArray *frameValues = [NSArray arrayWithObjects:
[NSValue valueWithCATransform3D:scale1],
[NSValue valueWithCATransform3D:scale2],
[NSValue valueWithCATransform3D:scale3],
[NSValue valueWithCATransform3D:scale4],
nil];
[animation setValues:frameValues];
NSArray *frameTimes = [NSArray arrayWithObjects:
[NSNumber numberWithFloat:0.0],
[NSNumber numberWithFloat:0.5],
[NSNumber numberWithFloat:0.9],
[NSNumber numberWithFloat:1.0],
nil];
[animation setKeyTimes:frameTimes];
animation.fillMode = kCAFillModeForwards;
animation.duration = 0.3f;
[sender.layer addAnimation:animation forKey:@"DSPopUpAnimation"];
}
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
Objective-C優(yōu)雅使用KVO觀察屬性值變化
這篇文章主要為大家介紹了Objective-C優(yōu)雅使用KVO觀察屬性值變化示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-08-08
Xcode 下刪除Provisioning Profiles文件詳細(xì)介紹
這篇文章主要介紹了Xcode 下刪除Provisioning Profiles文件詳細(xì)介紹的相關(guān)資料,需要的朋友可以參考下2016-12-12
詳解IOS11新特性之larget title的實(shí)現(xiàn)
本篇文章主要介紹了詳解IOS11新特性之larget title的實(shí)現(xiàn),小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-12-12
詳解iOS的UI開發(fā)中控制器的創(chuàng)建方法
這篇文章主要介紹了iOS的UI開發(fā)中控制器的創(chuàng)建方法,代碼基于傳統(tǒng)的Objective-C,需要的朋友可以參考下2015-11-11
iOS實(shí)現(xiàn)封裝一個獲取通訊錄的工具類詳解
這篇文章主要給大家介紹了關(guān)于iOS如何實(shí)現(xiàn)封裝一個獲取通訊錄的工具類的相關(guān)資料,這是自己平時封裝的一個工具類,使用非常方便,文中給出了詳細(xì)的示例代碼,需要的朋友們可以參考借鑒,下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧。2017-10-10
ios的collection控件的自定義布局實(shí)現(xiàn)與設(shè)計(jì)
這篇文章主要介紹了mac、iOS端支持自定義布局的collection控件的實(shí)現(xiàn)與設(shè)計(jì),需要的朋友學(xué)習(xí)參考下吧。2017-12-12
ios開發(fā)navigationController pushViewController 方式多次跳轉(zhuǎn)返回到最上層返回到
這篇文章主要介紹了ios開發(fā)navigationController pushViewController 方式多次跳轉(zhuǎn)返回到最上層返回到指定的某一層的實(shí)現(xiàn)方法的相關(guān)資料,非常不錯,具有參考借鑒價(jià)值,需要的朋友可以參考下2016-09-09

