你好,歡迎來到IOS教程網

 Ios教程網 >> IOS編程開發 >> IOS開發綜合 >> iOS倒計時的動畫效果

iOS倒計時的動畫效果

編輯:IOS開發綜合

-(void)countDown:(int)count{

if(count <=0){

//倒計時已到,作需要作的事吧。

return;

}

UILabel* lblCountDown = [[UILabel alloc] initWithFrame:CGRectMake(260, 120, 50, 50)];

lblCountDown.textColor = [UIColor redColor];

lblCountDown.font = [UIFont boldSystemFontOfSize:66];

lblCountDown.backgroundColor = [UIColor clearColor];

lblCountDown.text = String(@"%d",_SettedCountDown);

[self.view addSubview:lblCountDown];

[UIView animateWithDuration:1

delay:0

options:UIViewAnimationCurveEaseOut

animations:^{

lblCountDown.alpha = 0;

lblCountDown.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.5, 0.5);

}

completion:^(BOOL finished) {

[lblCountDown removeFromSuperview];

//遞歸調用,直到計時為零

[self countDown:count -1];

}

];

}

  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved