【问题标题】:Scaling webview animation缩放 webview 动画
【发布时间】:2013-05-08 06:33:02
【问题描述】:

我在大小为 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];

请告诉我如何缩放网页视图。

【问题讨论】:

标签: iphone ios uiwebview calayer cabasicanimation


【解决方案1】:

试试这个

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


}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多