我有一個UITableView
,我在loadView
中構建。我在loadView
中做的一件事是創建一個UIView
作爲表頭,並填入UIImageView
。圖片視圖包含一個圖片,這是一個風格化的標題,所以我想爲VoiceOver用戶添加輔助功能標籤。但是,爲了讀取標籤,我無法讓VoiceOver「聚焦」圖像,而輔助功能檢查器沒有響應單擊模擬器中的圖像。我(略)的代碼如下:在UITableView標題中包含的UIImageView上設置accessibilityLabel
... in -loadView ...
// Make header view
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(...)];
UIImageView *titleImageView = [[UIImageView alloc] initWithImage:[self titleImage]];
titleImageView.accessibilityLabel = [self accessibilityLabelForTitleImage];
[headerView addSubview:titleImageView];
// Make table view
self.tableView = [[UITableView alloc] initWithFrame:CGRect(...) style:UITableViewStylePlain];
self.tableView.tableHeaderView = headerView;
... code continues ...
我在gdb通過加強和accessibilityLabelForTitleImage
返回一個字符串。 po [titleImageView accessibilityLabel]
會打印出正確的字符串,但我仍然無法專注於圖像視圖。請注意,視圖本身會顯示並作出適當的響應。
我錯過了什麼嗎?有沒有辦法強制VoiceOver確認圖像視圖?
你這樣做了嗎? imageView.userInteractionEnabled = YES; –
不,我沒有意識到VoiceOver被視爲以這種方式進行交互。讓我來試試吧... – kevboh
不,userInteractionEnabled''設置爲YES(適用於攝像畫面和其父)不會讓我關注。 – kevboh