Re: Custom view has a wrong accessibilityFrame at startup
Re: Custom view has a wrong accessibilityFrame at startup
- Subject: Re: Custom view has a wrong accessibilityFrame at startup
- From: Fritz Anderson <email@hidden>
- Date: Thu, 01 Dec 2011 14:03:49 -0600
On 1 Dec 2011, at 1:55 PM, Chris Fleizach wrote:
> You still need to convert the frame to the window... This assumes that framElem starts out being the coordinate space of the view itself. So
>
> First manipulate it to get the size of the object in the coordinate space of the view.
>
> CGRect frameElem = self.bounds;
> // assumes object is half width of real object
> frameElem.size.width = framElem.size.width/2;
>
> // now convert to window space
>
> UIWindow *window = [self window];
> frameElem = [view convertRect:frameElem toView:window];
> frameElem = [window convertRect:frameElem toWindow:nil];
> elem.accessibilityFrame = frameElem;
I'm surprised, because Apple's sample code always calculates element rectangles from the view's .accessibilityFrame, as I do:
CGRect ownBounds = self.accessibilityFrame;
// ...
// Get the bounds-relative rect
frameElem = [self rectForSegment: i];
// Transform it to the view's accessibility coordinates
frameElem = CGRectOffset(frameElem,
ownBounds.origin.x,
ownBounds.origin.y);
Is view.accessibilityFrame unreliable? Should I file a bug against the documentation, or the API?
— F
_______________________________________________
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