我希望在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);
}];
答案 0 :(得分:2)
以下是上述Obj-C代码的快速代码:
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中做到这一点。