uiview 使用 swift 4 将动画从右到左(RTL)
uiview animated into right to left(RTL) using swift4
我需要为 UIView 制作动画。动画方向像从右到左。 (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)
})
}
我需要更改 UIView 动画方向是 (RTL) 谁能帮助我。
我得到了解决方案。解决方案是..
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
})
我需要为 UIView 制作动画。动画方向像从右到左。 (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)
})
}
我需要更改 UIView 动画方向是 (RTL) 谁能帮助我。
我得到了解决方案。解决方案是..
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
})