首页 > 代码库 > IOS UIView 放大缩小

IOS UIView 放大缩小

/创建缩小了的视图
myWeiBoImageVC = [[UIViewController alloc] init];
myWeiBoImageVC.view.clipsToBounds = YES;
myWeiBoImageVC.view.alpha = 0.0;
myWeiBoImageVC.view.frame = CGRectMake(64, 0, 1024-64, 768-20);
[self.view addSubview:myWeiBoImageVC.view];
    
CGAffineTransform newTransform = 
CGAffineTransformScale(myWeiBoImageVC.view.transform, 0.1, 0.1);
[myWeiBoImageVC.view setTransform:newTransform];
myWeiBoImageVC.view.center = CGPointMake(670, 100);
 
[self performSelector:@selector(imageViewControllerBigAnimation)];

//放大刚刚创建缩小后的视图
- (void)imageViewControllerBigAnimation{
   
    [UIView beginAnimations:@"imageViewBig" context:nil];
    [UIView setAnimationDuration:0.5];   
    CGAffineTransform newTransform =            CGAffineTransformConcat(myWeiBoImageVC.view.transform,  CGAffineTransformInvert(myWeiBoImageVC.view.transform));
    [myWeiBoImageVC.view setTransform:newTransform];
    myWeiBoImageVC.view.alpha = 1.0;
    myWeiBoImageVC.view.center = CGPointMake(416, 510);
    [UIView commitAnimations];
   
}

//缩小视图 隐藏

- (void)imageViewControllerSmallAnimation{

    [UIView beginAnimations:@"imageViewSmall" context:nil];
    [UIView setAnimationDuration:0.5];
    CGAffineTransform newTransform =  CGAffineTransformScale(myWeiBoImageVC.view.transform, 0.1, 0.1);
    [myWeiBoImageVC.view setTransform:newTransform];
    myWeiBoImageVC.view.center = CGPointMake(670, 100);
    [UIView commitAnimations];
   
}

IOS UIView 放大缩小