RTLManager.m 560 B

1234567891011121314151617181920212223242526
  1. //
  2. // RTLManager.m
  3. // JXCategoryView
  4. //
  5. // Created by jiaxin on 2020/7/3.
  6. //
  7. #import "RTLManager.h"
  8. @implementation RTLManager
  9. + (BOOL)supportRTL {
  10. return [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:UIView.appearance.semanticContentAttribute] == UIUserInterfaceLayoutDirectionRightToLeft;
  11. }
  12. + (void)horizontalFlipView:(UIView *)view {
  13. view.transform = CGAffineTransformMakeScale(-1, 1);
  14. }
  15. + (void)horizontalFlipViewIfNeeded:(UIView *)view {
  16. if ([self supportRTL]) {
  17. [self horizontalFlipView:view];
  18. }
  19. }
  20. @end