iOS字體抖動(dòng)動(dòng)畫的實(shí)現(xiàn)代碼
本文實(shí)例為大家分享了iOS字體抖動(dòng)的具體實(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]; //按鈕的動(dòng)畫效果 [self buttonAnimation:button]; } //按鈕出現(xiàn)的時(shí)候有一個(gè)動(dòng)畫效果 - (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)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- iOS實(shí)現(xiàn)支付寶螞蟻森林隨機(jī)按鈕及抖動(dòng)效果
- 詳解iOS中position:fixed吸底時(shí)的滑動(dòng)出現(xiàn)抖動(dòng)的解決方案
- iOS動(dòng)畫-定時(shí)對(duì)UIView進(jìn)行翻轉(zhuǎn)和抖動(dòng)的方法
- iOS實(shí)現(xiàn)自定義購物車角標(biāo)顯示購物數(shù)量(添加商品時(shí)角標(biāo)抖動(dòng) Vie)
- IOS倒計(jì)時(shí)設(shè)置UIButton標(biāo)題title的抖動(dòng)問題
- iOS自定義button抖動(dòng)效果并實(shí)現(xiàn)右上角刪除按鈕
- 仿iOS圖標(biāo)抖動(dòng)
- iOS實(shí)現(xiàn)圖片抖動(dòng)效果
相關(guān)文章
Objective-C優(yōu)雅使用KVO觀察屬性值變化
這篇文章主要為大家介紹了Objective-C優(yōu)雅使用KVO觀察屬性值變化示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-08-08Xcode 下刪除Provisioning Profiles文件詳細(xì)介紹
這篇文章主要介紹了Xcode 下刪除Provisioning Profiles文件詳細(xì)介紹的相關(guān)資料,需要的朋友可以參考下2016-12-12iOS實(shí)現(xiàn)相冊(cè)多選圖片上傳功能
這篇文章主要為大家詳細(xì)介紹了iOS實(shí)現(xiàn)相冊(cè)多選圖片上傳功能,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-08-08詳解IOS11新特性之larget title的實(shí)現(xiàn)
本篇文章主要介紹了詳解IOS11新特性之larget title的實(shí)現(xiàn),小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-12-12詳解iOS的UI開發(fā)中控制器的創(chuàng)建方法
這篇文章主要介紹了iOS的UI開發(fā)中控制器的創(chuàng)建方法,代碼基于傳統(tǒng)的Objective-C,需要的朋友可以參考下2015-11-11iOS實(shí)現(xiàn)封裝一個(gè)獲取通訊錄的工具類詳解
這篇文章主要給大家介紹了關(guān)于iOS如何實(shí)現(xiàn)封裝一個(gè)獲取通訊錄的工具類的相關(guān)資料,這是自己平時(shí)封裝的一個(gè)工具類,使用非常方便,文中給出了詳細(xì)的示例代碼,需要的朋友們可以參考借鑒,下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧。2017-10-10ios的collection控件的自定義布局實(shí)現(xiàn)與設(shè)計(jì)
這篇文章主要介紹了mac、iOS端支持自定義布局的collection控件的實(shí)現(xiàn)與設(shè)計(jì),需要的朋友學(xué)習(xí)參考下吧。2017-12-12ios開發(fā)navigationController pushViewController 方式多次跳轉(zhuǎn)返回到最上層返回到
這篇文章主要介紹了ios開發(fā)navigationController pushViewController 方式多次跳轉(zhuǎn)返回到最上層返回到指定的某一層的實(shí)現(xiàn)方法的相關(guān)資料,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2016-09-09