我想實現一個動畫,它從點視圖開始像循環展開並填充整個視圖。我已經實現了下面的代碼,但它不會循環地填充視圖。有任何想法嗎?圓形動畫
- (void)viewDidLoad {
[super viewDidLoad];
myView =[[UIView alloc]init];
myView.frame=CGRectMake(self.view.frame.size.width/2,self.view.frame.size.height/2+100, .1, .1);
myView.backgroundColor=[UIColor redColor];
[self.view addSubview:myView];
[self animate];
}
-(void)animate{
[UIView animateWithDuration:1.0
delay: 0.0
options:UIViewAnimationOptionCurveEaseOut
animations:^{
[self setRoundedView: myView toDiameter:1000];
}
completion:nil];
}
-(void)setRoundedView:(UIView *)roundedView toDiameter:(float)newSize;
{
CGPoint saveCenter = roundedView.center;
CGRect newFrame = CGRectMake(roundedView.frame.origin.x, roundedView.frame.origin.y, newSize, newSize);
roundedView.frame = newFrame;
roundedView.layer.cornerRadius = newSize/2.0;
roundedView.center = saveCenter;
}
http://stackoverflow.com/a/10902063/4030971 - 這將有所幫助。只需根據您的要求進行一些修改。 – 2015-03-03 05:15:24