我正在尝试反转带有一些子视图的 UIView(UILabels、按钮等......)
我这样做是通过
self.transform = CGAffineTransformMakeScale(-1,1);
有没有一种简单的方法可以防止子视图被反转
我正在尝试反转带有一些子视图的 UIView(UILabels、按钮等......)
我这样做是通过
self.transform = CGAffineTransformMakeScale(-1,1);
有没有一种简单的方法可以防止子视图被反转
您可以对所有子视图应用相同的变换,以便将它们反转两次:
CGAffineTransform t = CGAffineTransformMakeScale(-1, 1);
self.transform = t;
for (UIView *subview in self.subviews) {
subview.transform = t;
}
///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
}
}