title: Custom UIView Not Showing Accessibility on Voice Over
body: <p>I'm trying to get voice over working with an openGL view, specifically from the cocos2d framework. </p>
  
  <p>From the Apple Accessibility guide I followed this section: <a href="http://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/iPhoneAccessibility/Making_Application_Accessible/Making_Application_Accessible.html#//apple_ref/doc/uid/TP40008785-CH102-SW9" rel="nofollow">Make the Contents of Custom Container Views Accessible</a></p>
  
  <p>I've subclassed the view (CCGLView for cocos2d people), which is a UIView, to implement the informal UIAccessibilityContainer protocol.</p>
  
  <p><strong>UIAccessibilityContainer implementation in my subclassed UIView:</strong></p>
  
  <pre><code>-(NSArray *)accessibilityElements{
  return [self.delegate accessibleElements];
  }
  
  -(BOOL)isAccessibilityElement{
  return NO;
  }
  -(NSInteger)accessibilityElementCount{
  return [self accessibilityElements].count;
  }
  -(NSInteger)indexOfAccessibilityElement:(id)element{
  return [[self accessibilityElements] indexOfObject:element];
  }
  -(id)accessibilityElementAtIndex:(NSInteger)index{
  return [[self accessibilityElements] objectAtIndex:index];
  }
  </code></pre>
  
  <p>This code is getting called and <code>-(NSArray *)acessibilityElements</code> is returning an array of UIAccessibilityElements.  However the voice over controls are not showing up when I touch the screen.  Any ideas on what I'm missing or doing wrong?</p>
  
  <p><strong>Other Information:</strong></p>
  
  <p>I'm using a storyboard and adding the CCGLView to the UIView in the storyboard.  The _director.view is the CCGLView that I subclassed.</p>
  
  <pre><code> // Add the director as a child view controller.
  [self addChildViewController:_director];
  
  // Add the director's OpenGL view, and send it to the back of the view hierarchy so we can place UIKit elements on top of it.
  [self.view addSubview:_director.view];
  [self.view sendSubviewToBack:_director.view];
  </code></pre>
  
  <p>For a while I suspected that because I added the subview that this was causing it not to show up, but I also tried subclassing the UIView in the storyboard the same way but it was also not working.</p>
  
  <p>Also this is how I am creating each UIAccessibilityElement in the array.</p>
  
  <pre><code>UIAccessibilityElement *elm = [[UIAccessibilityElement alloc] initWithAccessibilityContainer:view];
      elm.accessibilityFrame = f;
      elm.accessibilityLabel = t.letter;
      elm.isAccessibilityElement = YES;
      elm.accessibilityHint = @"Button";
      elm.accessibilityValue = t.letter;
      elm.accessibilityTraits = UIAccessibilityTraitButton;
  </code></pre>