2014-10-23 2 views
1

초과 근무 시간을 확장하는 서클을 만드는 방법은 무엇입니까? 다음 대신확장 서클 만들기 iOS

[UIView animateWithDuration:5 animations:^(void){ 

    /* Expand the circle */ 

    // Get the contextRef 
    CGContextRef contextRef = UIGraphicsGetCurrentContext(); 

    // Set the border width 
    CGContextSetLineWidth(contextRef, 1.0); 

    // Set the circle fill color to Transparent 
    CGContextSetRGBFillColor(contextRef, 0.0, 0.0, 0.0, 0.0); 

    // Set the cicle border color to BLUE 
    CGContextSetRGBStrokeColor(contextRef, 0.0, 0.0, 255.0, 1.0); 

    // Fill the circle with the fill color 
    CGContextFillEllipseInRect(contextRef, self.view.frame); 

    // Draw the circle border 
    CGContextStrokeEllipseInRect(contextRef, self.view.frame); 
}]; 
+0

이 프레임의 크기를 애니메이션 사소한 , 많은 예를 보라. http://stackoverflow.com/a/6728458/294884 – Fattie

+0

"정말 할 일"하는 방법은 놀라운 것을 사용하는 것입니다 .. http://paintcodeapp.com – Fattie

답변

5

코드를 그리기없이 애니메이션 블록에 영향을있을 것이라는 점을

시도해보십시오 :이 같은 일을 할

// Create a view with a corner radius as the circle 
UIView* circle = [[UIView alloc] initWithFrame:CGRectMake(50, 50, 100, 100)]; 
[circle.layer setCornerRadius:circle.frame.size.width/2]; 
[circle setBackgroundColor:[UIColor redColor]]; 
[self.view addSubview:circle]; 

[UIView animateWithDuration:5 animations:^{ 

    // Animate it to double the size 
    const CGFloat scale = 2; 
    [circle setTransform:CGAffineTransformMakeScale(scale, scale)]; 
}]; 
+0

안녕하세요 남자 -별로 좋아지지 않을까요? ** 프레임의 크기를 애니메이션 화하는 것 ** ?? – Fattie

+0

@JoeBlow Blow 그게 내가 처음에 시도한거야.하지만 너는 코너 반경을 움직일 필요가있어. 그러면 나에게 문제가 생겼어. 가능하다면, 어떻게해야할지 모르겠다. – SomeGuy

+0

@SomeGuy 정말 고마워! – Apollo