如何在 swift 中为 UIWebView 设置动画?
How do you animate a UIWebView in swift?
我想在 Swift 中执行此操作,但我不知道如何在 swift 中编写:
webView.frame = CGRectMake(someX, self.view.frame.size.height, someWidth, someHeight);
webView.hidden = NO;
[UIView animateWithDuration:1.0 animations:^{
webView.frame = CGRectMake(someX, self.view.frame.size.height/2, someWidth, someHeight);
}];
这是上述 Obj-C 代码的 swift 代码:
webView.frame = CGRectMake(someX, someY, someWidth, someHeight)
webView.hidden = false
UIView.animateWithDuration(duration, delay: 0.0, options: UIViewAnimationOptions(animationCurve), animations: { () -> Void in
webView.frame = CGRectMake(someX, someOtherY, someWidth, someHeight)
}, completion: {(finished) -> () in
// you can leave this empty
})
那应该在 Swift 中完成。
我想在 Swift 中执行此操作,但我不知道如何在 swift 中编写:
webView.frame = CGRectMake(someX, self.view.frame.size.height, someWidth, someHeight);
webView.hidden = NO;
[UIView animateWithDuration:1.0 animations:^{
webView.frame = CGRectMake(someX, self.view.frame.size.height/2, someWidth, someHeight);
}];
这是上述 Obj-C 代码的 swift 代码:
webView.frame = CGRectMake(someX, someY, someWidth, someHeight)
webView.hidden = false
UIView.animateWithDuration(duration, delay: 0.0, options: UIViewAnimationOptions(animationCurve), animations: { () -> Void in
webView.frame = CGRectMake(someX, someOtherY, someWidth, someHeight)
}, completion: {(finished) -> () in
// you can leave this empty
})
那应该在 Swift 中完成。