I really know how to do this, but the way I do this leads me to my two real questions. First, I change this frame in a subclass of UIButton as follows:
- (CGRect)accessibilityFrame {
CGRect rect = [self.superview convertRect:self.frame toView:nil];
rect.size.width *= 5;
return rect;
}
If I omit the first line of this method, then the accessibility frame for this button is displayed in the absolute upper left corner of the screen, regardless of its initial position. All the code samples that I found to override the accessibility framework use some kind of coordinate transformation, but I donβt understand why at all. Why can't this property be processed in the same coordinate system as the viewing frame, since this would make changing the accessibility frame easier?
My second question is about how this accessibility frame really works with VoiceOver turned on. When I change the accessibility frame this way, the focus rectangle gets bigger as expected. Unfortunately, this effect seems purely cosmetic. Despite the fact that the focus rectangle is now much larger than the button itself, I can still apply focus only to the button by clicking within the corresponding button; if I touch the focus rectangle, but nothing happens outside the button itself. This is a big problem for me because I am trying to expand the "virtual" size of some controls that are so small that they are very difficult to press if you do not see them. I donβt understand how to make the rectangle of focus only cosmetically larger,if visually impaired users cannot see it.
: :
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {
CGPoint newPoint = [self.superview convertPoint:point toView:nil];
return CGRectContainsPoint(self.accessibilityFrame, newPoint);
}
, - .
2: ( -). :
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {
CGPoint newPoint = [self convertPoint:point toView:nil];
return CGRectContainsPoint(self.accessibilityFrame, newPoint);
}