简体   繁体   中英

uiview animated into right to left(RTL) using swift4

I need to animated a UIView. the animation direction like Right to left. (RTL) I use a left to right (LTR) animation code is given below (LTR) Code:

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.

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
        })

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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