2016-09-01 5 views
0

내 앱에 여러 개의 UIWindows이 있습니다. 일부 UIWindows에는 매우 높은 창 수준이 있습니다. 즉 어떤 이유UIAccessibility에서 올바른 요소를 선택하지 않았습니다.

window.windowLevel = currentWindowLevel+1; 

보조 기능의 서포트를 켤 때, 시스템은도 전망도 보이지 않는 경우, 낮은 레벨의 윈도우에있는 뷰의 접근성 라벨을 읽고 주장한다.

이 최소한의 예제는이 동작을 보여줍니다.

내게 필요한 옵션 지원이 켜져 있으면 빨간색 창에서 레이블을 눌러보십시오. 이 시스템은 대신

@interface ViewController() <UITableViewDataSource> 
@property (weak, nonatomic) IBOutlet UITableView *tableview; 

@end 

@implementation ViewController 

- (void)viewDidLoad { 
    [super viewDidLoad]; 
    self.tableview.dataSource = self; 
    [self.tableview registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"]; 

    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 
     UIWindow *w = [[UIWindow alloc] initWithFrame:self.view.bounds]; 
     w.windowLevel = self.view.window.windowLevel + 1; 
     w.backgroundColor = [UIColor redColor]; 
     w.hidden = NO; 
     w.isAccessibilityElement = YES; 
     UILabel *l = [[UILabel alloc] init]; 
     l.text = @"KUKUKUKUKUKUKUKLU"; 
     [l sizeToFit]; 
     l.frame = CGRectOffset(l.frame, 40, 100); 
     [w addSubview:l]; 
     w.accessibilityLabel = @"Read this outloud instead"; 
     static id window; 
     window = w; 
    }); 

    // Do any additional setup after loading the view, typically from a nib. 
} 

- (void)didReceiveMemoryWarning { 
    [super didReceiveMemoryWarning]; 
    // Dispose of any resources that can be recreated. 
} 

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 
    return 100; 
} 

// Row display. Implementers should *always* try to reuse cells by setting each cell's reuseIdentifier and querying for available reusable cells with dequeueReusableCellWithIdentifier: 
// Cell gets various attributes set automatically based on table (separators) and data source (accessory views, editing controls) 
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath]; 
    cell.textLabel.text = @"Test"; 
    return cell; 
} 

@end 
+0

이 질문에 무관 한게 속성을 설정하는 것입니다 아래 테이블보기에서 텍스트를 읽습니다. 나는 어떤 경우에도 대답을 제공했다. –

답변

1

솔루션

Window.accessibilityViewIsModal = YES; 
관련 문제