Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Accessibility #184

Merged
merged 4 commits into from

2 participants

@mikevpark

First attempts at making Month View Accessible.

mikevpark added some commits
@mikevpark mikevpark Accessibility for TKCalendarMonthView
First attempts at making Month View Accessible.
65b0cd2
@mikevpark mikevpark Accessibility
Accessibility Support for Calendar View.

Signed-off-by: mikevpark <mikevpark@hotmail.com>
6c1d9a8
@mikevpark mikevpark Accessibility
Accessibility for Calendar View.

Signed-off-by: mikevpark <mikevpark@hotmail.com>
abed738
@mikevpark mikevpark Merge branch 'master' of https://github.com/mikevpark/tapkulibrary
Conflicts:
	src/TapkuLibrary/TKCalendarMonthView.m

Signed-off-by: mikevpark <mikevpark@hotmail.com>
0917fe4
@mikevpark

Devin, I have the Accessibility working on the Calendar now including the daily tiles. It could use a little more info such as the day of week info, possibly even the month as part of each day. I'm hoping maybe you could provide those updates.

@devinross
Owner

Sweet, I'm looking through it now.

@devinross devinross merged commit 0f83a6a into devinross:master
@mikevpark
@devinross
Owner

I think I got it close to what the Calendar.app has in terms of information and functionality. It states the full date as such: "Weekday Month Day, Year".

@devinross
Owner

Thanks Mike for getting me started on this.

@mikevpark
@devinross
Owner

I'd try merging my changes back to your fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 18, 2012
  1. @mikevpark

    Accessibility for TKCalendarMonthView

    mikevpark authored
    First attempts at making Month View Accessible.
Commits on Aug 20, 2012
  1. @mikevpark

    Accessibility

    mikevpark authored
    Accessibility Support for Calendar View.
    
    Signed-off-by: mikevpark <mikevpark@hotmail.com>
  2. @mikevpark

    Accessibility

    mikevpark authored
    Accessibility for Calendar View.
    
    Signed-off-by: mikevpark <mikevpark@hotmail.com>
  3. @mikevpark

    Merge branch 'master' of https://github.com/mikevpark/tapkulibrary

    mikevpark authored
    Conflicts:
    	src/TapkuLibrary/TKCalendarMonthView.m
    
    Signed-off-by: mikevpark <mikevpark@hotmail.com>
This page is out of date. Refresh to see the latest.
Showing with 72 additions and 2 deletions.
  1. +72 −2 src/TapkuLibrary/TKCalendarMonthView.m
View
74 src/TapkuLibrary/TKCalendarMonthView.m
@@ -142,6 +142,7 @@ @interface TKCalendarMonthTiles : UIView {
BOOL startOnSunday;
}
@property (strong,nonatomic) NSDate *monthDate;
+@property (nonatomic, strong) NSMutableArray *accessibleElements;
- (id) initWithMonth:(NSDate*)date marks:(NSArray*)marks startDayOnSunday:(BOOL)sunday;
- (void) setTarget:(id)target action:(SEL)action;
@@ -166,6 +167,42 @@ @interface TKCalendarMonthTiles (private)
@implementation TKCalendarMonthTiles
@synthesize monthDate;
+#pragma mark - Accessibility Container methods
+
+- (NSArray *)accessibleElements
+{
+ if (_accessibleElements != nil)
+ {
+ return _accessibleElements;
+ }
+
+ _accessibleElements = [[NSMutableArray alloc] init];
+
+ return _accessibleElements;
+}
+
+//The container itself is not accessible
+- (BOOL)isAccessibilityElement
+{
+ return NO;
+}
+
+- (NSInteger)accessibilityElementCount
+{
+ return [[self accessibleElements] count];
+}
+
+- (id)accessibilityElementAtIndex:(NSInteger)index
+{
+ return [[self accessibleElements] objectAtIndex:index];
+}
+
+- (NSInteger)indexOfAccessibilityElement:(id)element
+{
+ return [[self accessibleElements] indexOfObject:element];
+}
+
+#pragma mark - Init Methods
+ (NSArray*) rangeOfDatesInMonthGrid:(NSDate*)date startOnSunday:(BOOL)sunday{
@@ -303,7 +340,12 @@ - (id) initWithMonth:(NSDate*)date marks:(NSArray*)markArray startDayOnSunday:(B
[self.selectedImageView addSubview:self.currentDay];
[self.selectedImageView addSubview:self.dot];
self.multipleTouchEnabled = NO;
-
+
+ //Set Accessibility
+ self.selectedImageView.isAccessibilityElement = YES;
+ self.selectedImageView.accessibilityTraits = UIAccessibilityTraitButton;
+ self.selectedImageView.accessibilityLabel = [NSString stringWithFormat:@"Day %@, %@", self.currentDay.text, self.dot ? @"Activities" : @"No Activities"];
+
return self;
}
@@ -341,7 +383,15 @@ - (void) drawTileInRect:(CGRect)r day:(int)day mark:(BOOL)mark font:(UIFont*)f1
alignment: UITextAlignmentCenter];
}
-
+ //Set Accessibility
+ UIAccessibilityElement *tileElement = [[UIAccessibilityElement alloc] initWithAccessibilityContainer:self];
+ tileElement.accessibilityFrame = [self convertRect:r toView:nil];
+ tileElement.accessibilityLabel = str;
+ tileElement.accessibilityValue = mark ? @"Activities" : @"No Activities";
+ tileElement.accessibilityTraits = UIAccessibilityTraitUpdatesFrequently;
+
+ [_accessibleElements addObject:tileElement];
+
}
- (void) drawRect:(CGRect)rect {
@@ -717,6 +767,24 @@ - (id) initWithSundayAsFirst:(BOOL)s{
for(NSString *s in ar){
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(46 * i, 29, 46, 15)];
[self addSubview:label];
+
+ //Added Accessibility Labels
+ if ([s isEqualToString:@"Sun"]) {
+ label.accessibilityLabel = @"Sunday";
+ } else if ([s isEqualToString:@"Mon"]) {
+ label.accessibilityLabel = @"Monday";
+ } else if ([s isEqualToString:@"Tue"]) {
+ label.accessibilityLabel = @"Tuesday";
+ } else if ([s isEqualToString:@"Wed"]) {
+ label.accessibilityLabel = @"Wednesday";
+ } else if ([s isEqualToString:@"Thu"]) {
+ label.accessibilityLabel = @"Thursday";
+ } else if ([s isEqualToString:@"Fri"]) {
+ label.accessibilityLabel = @"Friday";
+ } else if ([s isEqualToString:@"Sat"]) {
+ label.accessibilityLabel = @"Saturday";
+ }
+
label.text = s;
label.textAlignment = UITextAlignmentCenter;
label.shadowColor = [UIColor whiteColor];
@@ -973,6 +1041,7 @@ - (UIButton *) leftArrow{
if(leftArrow==nil){
leftArrow = [UIButton buttonWithType:UIButtonTypeCustom];
leftArrow.tag = 0;
+ leftArrow.accessibilityLabel = @"Previous Month";
[leftArrow addTarget:self action:@selector(changeMonth:) forControlEvents:UIControlEventTouchUpInside];
[leftArrow setImage:[UIImage imageNamedTK:@"TapkuLibrary.bundle/Images/calendar/Month Calendar Left Arrow"] forState:0];
leftArrow.frame = CGRectMake(0, 0, 48, 38);
@@ -983,6 +1052,7 @@ - (UIButton *) rightArrow{
if(rightArrow==nil){
rightArrow = [UIButton buttonWithType:UIButtonTypeCustom];
rightArrow.tag = 1;
+ rightArrow.accessibilityLabel = @"Next Month";
[rightArrow addTarget:self action:@selector(changeMonth:) forControlEvents:UIControlEventTouchUpInside];
rightArrow.frame = CGRectMake(320-45, 0, 48, 38);
[rightArrow setImage:[UIImage imageNamedTK:@"TapkuLibrary.bundle/Images/calendar/Month Calendar Right Arrow"] forState:0];
Something went wrong with that request. Please try again.