2017-07-15 5 views
2

私はiOSの新機能です。ボイスオーバー機能を含むアプリを作っています。私のアプリはコレクションビューからなっています。アプリケーションにはチェックボックスがあり(ボタンなしの画像は表示されません)、チェックされている/表示されていないステータスが表示されます。

チェックボックスをオンにしてから、これを読み上げるときにボイスオーバーしました。 - > [self.checkBoxImageView setAccessibilityHint:@ "~~~~"];
最初に試したときに正しい操作(ボイスオーバー)があったが、もう一度のボイスオーバーで読み返した後にになった。
操作したいコードを修正するにはどうすればよいですか?
下に自分のコードを添付してください。
最初の機能=========================================================================================================================================== ====
遅延フォーカス状態になるボイスオーバーAPIはありますか?

- (void)setChecked:(BOOL)checked { 
NSLog(@"%s, checked = %d", __func__, _checked); 
NSLog(@"[D] checked : %d", checked); 
// Save property value 
_checked = checked; 

// Update checkbox image 
NSString * filename; 

if(checked) 
{ 
    filename = [[NSBundle bundleForClass:[self class]] pathForResource:@"check_on" ofType:@"png"]; 
    [self.checkBoxImageView setAccessibilityHint:@"Checked"]; 

} 
else 
{ 
    filename = [[NSBundle bundleForClass:[self class]] pathForResource:@"check_off" ofType:@"png"]; 
    [self.checkBoxImageView setAccessibilityHint:@"Unchecked"]; 
} 

[self.checkBoxImageView setImage:[UIImage imageWithContentsOfFile:filename]]; 

NSLog(@"[D] self.checkBoxImageView setImage:[UIImage"); 
self.checkBoxImageView.frame = CGRectMake(12, 12, 50/2, 50/2); 
NSLog(@"[D] self.checkBoxImageView.frame = CGRectMake"); 
} 

=========================別の関数============ =============

- (void) collectionView:(UICollectionView *)cv didSelectItemAtIndexPath:(NSIndexPath *)indexPath 
{ 
    NSLog(@"%s", __func__); 
    NSLog(@"%@", indexPath.description); 

    //[collectionView deselectItemAtIndexPath:indexPath animated:YES]; 
    //// Get selected cell 
    //MYCell* cell = (MYCell*) [collectionView cellForItemAtIndexPath:indexPath]; 

    [cv deselectItemAtIndexPath:indexPath animated:NO]; 
    // Get selected cell 
    MYCell* cell = (MYCell*) [cv cellForItemAtIndexPath:indexPath]; 

// if (cell.checked == NO) 
//  cell.checked = YES; 
// else if (cell.checked == YES) 
//  cell.checked = NO; 

    // Check if set contains selected cell indexPath 
    if([self.checkedIndexPaths member:indexPath]) 
    { 
     // User tapped on checked cell 
     // Remove selected indexPath from set 
     [self.checkedIndexPaths removeObject:indexPath]; 

     // Uncheck checkbox on cell 
     cell.checked = NO; 
    } 
    else // User tapped on unchecked cell 
    { 
     // Add selected indexPath to set 
     [self.checkedIndexPaths addObject:indexPath]; 

     // Check checkbox on cell 
     cell.checked = YES; 
    } 


} 
+0

チェックボックスにチェックを入れずにフォーカスを合わせ、チェックボックスをオンにして、操作を修正する必要がある場合は、 –

答えて

0

アクセシビリティのヒントは要素が何をするかについての追加情報であることを意図しています。したがって、システム上のボイスオーバーは、ページのレイアウトが変更されない限り、コンテンツがほとんど静的なままであることを前提としています。また、ボイスオーバーモードがオンになっていても、多くのユーザーが電源をオフにしていることにも注意してください。

この場合に設定するプロパティは、accessibilityValueApple doc)です。これは、UITextFieldのテキストなど、要素の動的コンテンツに使用されます。

+0

ありがとうございます〜!!! Appleのdocサイトにアクセスしてサンプルコードをダウンロードしました。私はこのコードを実行しています。しかし...私はiOSで新しい.......だから、私のコードを適用するのは難しいです...私はますます試みます!どうもありがとう!!良い一日を〜 –

関連する問題