-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathViewController.m
72 lines (55 loc) · 1.78 KB
/
ViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//
// ViewController.m
// UIKit-UIAccessibility
//
// Created by 王钱钧 on 14-9-1.
// Copyright (c) 2014年 王钱钧. All rights reserved.
//
// https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/iPhoneAccessibility/Introduction/Introduction.html
//http://wenku.baidu.com/view/d1c77a781711cc7931b716d7###
#import "ViewController.h"
@interface ViewController ()
@property (nonatomic, strong) NSMutableArray *accessibleElements;
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[self setIsAccessibilityElement:YES];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (NSMutableArray *)accessibleElements
{
if (_accessibleElements != nil) {
return _accessibleElements;
}
_accessibleElements = [[NSMutableArray alloc]init];
UIAccessibilityElement *element1 = [[UIAccessibilityElement alloc]initWithAccessibilityContainer:self];
[_accessibleElements addObject: element1];
UIAccessibilityElement *element2 = [[UIAccessibilityElement alloc]initWithAccessibilityContainer:self];
[_accessibleElements addObject:element2];
return _accessibleElements;
}
- (BOOL)isAccessibilityElement
{
return YES;
}
/* The following methods are implementations of UIAccessibilityContainer protocol methods. */
- (NSInteger)accessibilityElementCount
{
return [[self accessibleElements] count];
}
- (id)accessibilityElementAtIndex:(NSInteger)index
{
return [[self accessibleElements] objectAtIndex:index];
}
- (NSInteger)indexOfAccessibilityElement:(id)element
{
return [[self accessibleElements] indexOfObject:element];
}
@end