UIView Rounded Circular view Transition

238 Views Asked by At

I have implemented Circular transitions as i asked in

animating UIView transitions like expand dot to circle

using following code:

    -(IBAction)nextViewOpen
    {   
        NextViewVC *NextView= [self.storyboard instantiateViewControllerWithIdentifier:@"RBANextViewVC"];


        [NextView.view.layer setCornerRadius:25.0f];
        [NextView.view.layer setMasksToBounds:YES];
        NextView.view.frame=CGRectMake(100,120, 1, 1);
        [self.view addSubview:NextView.view];
        [self setRoundedView:NextView.view toDiameter:5];
        [UIView animateWithDuration:5.0 animations:^{

   ====== [self setRoundedView:NextView.view toDiameter:480]; ======

    }
                     completion:^(BOOL finished)
     {
         NextView.view.frame=CGRectMake(0, 0, 320, 480);
         NextView.view.layer.cornerRadius = 0;
     }
     ];
}



-(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.layer.cornerRadius = roundedView.frame.size.width / 2.0;
    roundedView.center = saveCenter;
    roundedView.clipsToBounds = YES;
}

But it is having some issues

the view gets complete circle shape at the end of the animated transition, initially its not having rounded corners perfectly

enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here

0

There are 0 best solutions below