0

我在大小为 50x50(宽度和高度)的视图控制器中有 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];

请告诉我如何缩放 webview 。

4

1 回答 1

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)];


}
于 2013-05-08T07:06:27.203 回答