简体   繁体   English

uiview使用swift4动画成从右到左(RTL)

[英]uiview animated into right to left(RTL) using swift4

I need to animated a UIView. 我需要给UIView设置动画。 the animation direction like Right to left. 动画方向如从右到左。 (RTL) I use a left to right (LTR) animation code is given below (LTR) Code: (RTL)我使用从左到右(LTR)的动画代码,以下是(LTR)代码:

UIView.animate(withDuration: 0.5, delay: 0.25, options: UIViewAnimationOptions(),
    animations: { () -> Void in
        self.viewSideMenuHolder.frame = CGRect(x: 0, y: 0,width: self.view.frame.size.width ,height: self.view.frame.size.height)
    },
    completion: { (finished: Bool) -> Void in
        self.viewSideMenuHolder.backgroundColor = UIColor.black.withAlphaComponent(0.5)
    })
}

I need to change a UIView animated direction is (RTL) any one help me. 我需要将UIView动画方向更改为(RTL)任何人都可以帮助我。

I got the Solution. 我得到了解决方案。 Solution is.. 解决方法是..

       UIView.animate(withDuration: 0.5, delay: 0.25, options: UIViewAnimationOptions(), animations: { () -> Void in
            self.viewSideMenuHolder.frame = CGRect(x: self.view.frame.size.width, y: 0,width: self.view.frame.size.width ,height: self.view.frame.size.height)
        }, completion: { (finished: Bool) -> Void in
            self.viewSideMenuHolder.backgroundColor = UIColor.clear
        })

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM