修改XIB 中的 Accessibility(旁白,Voice

2022-06-16  本文已影响0人  阳光下的灰尘

如果修改XIB 中的 Accessibility(旁白,VoiceOver)顺序

@implementation UIView (HJAccessibilityByXIBView)

- (void)updateOrder {
    NSMutableArray *tempElements = @[].mutableCopy;
    NSEnumerator *enumerator = [self.subviews objectEnumerator];
    UIView *view = nil;  //不确定数组里面具体对象的类型,所以定义成id 类型指针
    while (view = [enumerator nextObject]) { //通过枚举器,取数组里面的每一个元素
        NSLog(@"%@", view);                  //将元素赋给 obj, 直到数组结束
        [tempElements addObject:view];
    }
    self.accessibilityElements = tempElements;
}

@end

#import "HJReorderAccessibilityByXIBView.h"

@implementation HJReorderAccessibilityByXIBView

- (void)didAddSubview:(UIView *)subview {
    [self updateOrder];
}

@end
上一篇 下一篇

猜你喜欢

热点阅读