Re: changing accessibility frame and touching an object
Re: changing accessibility frame and touching an object
- Subject: Re: changing accessibility frame and touching an object
- From: Scott McCormack <email@hidden>
- Date: Tue, 11 Jun 2013 12:12:27 -0700
Hi Chris (and list),
I tried this and it works except for 2 issues:
- When I flip the switch VO announces the state twice: right after you toggle the setting it announces the "old" state then it announces the current state. So as an example the switch is off and I toggle it on I hear "Whatever Off" then "Whatever On".
To accomplish the change I have a method that gives me an On or Off in english since accessibilityValue of the switch is just a 1 or 0 then I change the accessibility value of the view when the switch value changes:
- (NSString *)switchState:(UISwitch *)sender {
if ([sender isOn]) {
return @"on";
} else {
return @"off";
}
}
then in my value change event for the switch I do this:
[self.theSwitchView setAccessibilityValue:[self switchState:sender]];
- Finally there is no hint text (double tap to toggle setting) -- I assume I just have to set this manually?0
I am trying to duplicate the behavior like I see in the Settings app for the airplane mode button. I realize that the airplane mode option is a table cell but as a table cell is a view and I am guessing Apple is doing something similar to the above to combine the switch and label into a single item that I can accomplish the same with the addition of the hint and getting rid of the extra premature state announcement.
On May 31, 2013, at 11:25 PM, Chris Fleizach <email@hidden> wrote:
> You probably want to make a container view that encompasses both elements.
>
> Then that element can be the accessibility element and inherit its label, value and activationPoint from the switch and the labe
>
> On May 31, 2013, at 6:34 PM, Scott McCormack <email@hidden> wrote:
>
>> I have a UISwitch that I am chaining it's accessibilityFrame to cover the UILabel next to it as well. Everything is working as excepted except when I try and touch the switch to select it I still have to touch the switch itself rather than the larger frame that includes the UILabel. Here's the code that I use to change the accessibilityFrame:
>>
>> CGRect mergedSwitchRect = CGRectUnion(self.shouldGroupLabel.accessibilityFrame, self.shouldGroupSwitch.accessibilityFrame);
>> CGPoint switchPoint = self.shouldGroupSwitch.accessibilityActivationPoint;
>> self.shouldGroupSwitch.accessibilityFrame = mergedSwitchRect;
>> self.shouldGroupSwitch.accessibilityActivationPoint = switchPoint;
>>
>> The UILabel is not accessibilityEnabled as I want the switch (with it's expanded frame) to get VO focus not the label.
>>
>> ---
>> Scott McCormack
>> Senior Accessibility Consultant - IT Manager
>> SSB BART Group
>> email@hidden
>> www.ssbbartgroup.com
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Accessibility-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden