2

アプリをよりアクセスしやすくしようとしています。このコードを使用して、UIViewController に追加されるカスタム UIView を作成しました。

emergenteTiempos *emer = [emergenteTiempos shared:self.view];
[self.view addSubview:emer];

このコードは、カスタム UIView を呼び出します。

私のxibファイル

Making app Accessibleで、コンテナーのアクセシビリティをオフにする必要があることを読みました。私の場合は、すべての要素 (UILabel、UIButton) を含む UIView ですが、これらの要素のアクセシビリティを個別に確認する必要があります。だから私はこれをしました:

要素へのアクセシビリティの設定

ただし、カスタム ビューが画面に表示されると、Voice Over は自動的に何も読み上げません。ボイスオーバーがこの要素のラベルを言うには、各要素を押し込む必要があります。

ビューが表示されたときに、Voice Over がすべてのフィールドを自動的に発音するようにします。次のような多くのことを試しました。

@implementation MultiFacetedView
- (NSArray *)accessibleElements
{
   if ( _accessibleElements != nil )
   {
      return _accessibleElements;
   }
   _accessibleElements = [[NSMutableArray alloc] init];

   /* Create an accessibility element to represent the first contained element and initialize it as a component of MultiFacetedView. */
   UIAccessibilityElement *element1 = [[[UIAccessibilityElement alloc] initWithAccessibilityContainer:self] autorelease];

   /* Set attributes of the first contained element here. */
   [_accessibleElements addObject:element1];

   /* Perform similar steps for the second contained element. */
   UIAccessibilityElement *element2 = [[[UIAccessibilityElement alloc] initWithAccessibilityContainer:self] autorelease];

   /* Set attributes of the second contained element here. */
   [_accessibleElements addObject:element2];

   return _accessibleElements;
}

/* The container itself is not accessible, so MultiFacetedView should return NO in isAccessiblityElement. */
- (BOOL)isAccessibilityElement
{
   return NO;
}

/* The following methods are implementations of UIAccessibilityContainer protocol methods. */
- (NSInteger)accessibilityElementCount
{
   return [[self accessibleElements] count];
}

- (id)accessibilityElementAtIndex:(NSInteger)index
{
   return [[self accessibleElements] objectAtIndex:index];
}

- (NSInteger)indexOfAccessibilityElement:(id)element
{
   return [[self accessibleElements] indexOfObject:element];
}
@end

ただし、Voice Over は自動的に何も読み上げません。

私たちを手伝ってくれますか?どうもありがとうございました!

4

0 に答える 0