Note that there are some explanatory texts on larger screens.

plurals
  1. POUIAccessoryElement, accessoryFrame and screen rotation broken
    text
    copied!<p>I have a UIControl subclass which follows the UIAccessibilityContainer informal protocol: it returns NO to -isAccessibilityElement, delivers the correct -accessibilityElementCount and elements in the accessors.</p> <p>Each UIAccessibilityElement which is created to represent an accessibility region is created successfully, and the frame is a 1:1 mapping of another CGRect I'm drawing.</p> <p>E.g., I'm drawing into {94, 99}, {209, 350}} and the -accessibilityFrame on the UIAccessibilityElement is set to the same CGRect value.</p> <p>However, when in landscape (or upside-down portrait) orientation, the frames (only for accessibility elements, drawing still works fine) are rotated incorrectly. The top-left point relative to the frame is always the corner top-left of the home button.</p> <p>Here's a screenshot from the simulator:</p> <p><img src="https://i.stack.imgur.com/xRckG.png" alt="Screenshot"></p> <p>As you can see, it's in landscape mode, and the frame is totally impossibly not what it's specifying.</p> <p>Here's the code driving the creation of the elements:</p> <pre><code>CGRect localRect = someCGRectVariable; CGRect globalRect = CGRectOffset(localRect, CGRectGetMinX(self.accessibilityFrame), CGRectGetMinY(self.accessibilityFrame)); UIAccessibilityElement *accElem = [[UIAccessibilityElement alloc]initWithAccessibilityContainer:self]; accElem.isAccessibilityElement = YES; accElem.accessibilityFrame = globalRect; accElem.accessibilityHint = [NSString stringWithFormat:NSLocalizedString(@"xyz %@", nil), someName]; accElem.accessibilityTraits = UIAccessibilityTraitButton; accElem.accessibilityLabel = nameValue; </code></pre> <p>It looks to me like the rotation is busted, but I can't put my finger on it. It's worth noting that it works perfectly fine in portrait mode.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload