缩放webview动画

时间:2013-05-08 06:33:03

标签: iphone ios uiwebview calayer cabasicanimation

我在一个大小为50x50(宽度和高度)的viewcontroller中有webview。我有按钮来缩放/拉伸webview的宽度和高度。因此,每当按下按钮时,我想增加webview的高度和宽度。我想和动画一起实现这一点。 我尝试使用以下代码,但它无法正常工作。

        CALayer* simple = [[CALayer alloc]init];
        simple = webView.layer;
        CATransform3D currentTransform = simple.transform;
        CATransform3D scaled = CATransform3DScale(currentTransform, 1.5, 1.5, 1.5);
        simple.transform = scaled;
        [simple setNeedsDisplay];

请告诉我如何扩展网页浏览。

1 个答案:

答案 0 :(得分:0)

试试这个

-(IBAction) incresethegeight:(id)sender
{



    [UIView animateWithDuration:2 delay:1.0
                        options:UIViewAnimationOptionBeginFromCurrentState
                     animations:^{ self.view.alpha = 1; }
                     completion:^(BOOL fin){[self  addHeight ];}];
}

-(void) addHeight
{  float height = webview.frame.size.height;

    CALayer* simple = [[CALayer alloc]init];
    simple = webview.layer;
    CATransform3D currentTransform = simple.transform;
    CATransform3D scaled = CATransform3DScale(currentTransform, 1.5, 1.5, 1.5);
    simple.transform = scaled;
    [simple setNeedsDisplay];
  // or  
//   [webview setFrame:CGRectMake(0.0f, 0.0f, 320, height +30)];


}