我正在尝试用它上面的一些子视图来反转UIView(UILabels,Buttons等等......)
我是通过
来做的self.transform = CGAffineTransformMakeScale(-1,1);
是否有一种简单的方法可以防止子视图被反转
答案 0 :(得分:2)
您可以将相同的变换应用于所有子视图,以便它们反转两次:
CGAffineTransform t = CGAffineTransformMakeScale(-1, 1);
self.transform = t;
for (UIView *subview in self.subviews) {
subview.transform = t;
}
答案 1 :(得分:0)
///Reverse the Tabs from RightToLeft
public func rightToLeft() {
let t = CGAffineTransform.init(scaleX: -1, y: -1)
self.transform = t
self.subviews.forEach { (subview) in
subview.transform = t
}
}
///Reverse the Tabs from LeftToRight
public func leftToRight() {
let t = CGAffineTransform.init(scaleX: 1, y: 1)
self.transform = t
self.subviews.forEach { (subview) in
subview.transform = t
}
}