2013-05-08 123 views
0

我有一個尺寸爲50x50(寬度和高度)的視圖控制器的webview。我有按鈕來縮放/拉伸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]; 

請告訴我如何縮放web視圖。

+0

試圖解釋的問題properly.then你可能會得到你的答案。 – Deepesh 2013-05-08 06:42:53

+0

@Deepesh。 PLease查找更新後的問題 – Cyril 2013-05-08 06:46:10

+0

檢查http://stackoverflow.com/a/13250432/1106035 – 2013-05-08 07:04:21

回答

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


}