2012-11-14 158 views
4

移動語音焦點中的tableView第一個單元格我有兩個UITableViewControllers一個主窗口。在選擇第一個tableViewController(左側窗格)中的單元格時,將會填充權限上的tableViewContainer。在Voice over模式中,我希望當第一個tableViewController中的單元格被選中時,secondViewController中的第一個單元格獲得焦點,以便輕彈順序從那裏開始。請注意,我已經嘗試以下兩種方法:輔助功能:在的UITableViewController

1)使第二視圖控制器,該firstResponder的第一個單元格。

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 

{   
    UITableViewCell *outCell =(UITableCellView*) [tableView dequeueReusableCellWithIdentifier:MyIdentifier]; 
    if (indexPath.row == 0) 
    { 
     [outCell becomeFirstResponder]; 
    } 
} 

2)我也嘗試發佈佈局更改通知給予單元格作爲第一個輔助功能項目。

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{   
    UITableViewCell *outCell =(UITableCellView*) [tableView dequeueReusableCellWithIdentifier:MyIdentifier]; 

    if (indexPath.row == 0) 
    { 
     UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, outCell); 
    } 
} 

無上述方法的工作。任何想法我還有什麼可以嘗試或上述方法有什麼問題?

請注意:我已閱讀查看控制器的文檔(https://developer.apple.com/LIBRARY/IOS/#featuredarticles/ViewControllerPGforiPhoneOS/Accessibility/AccessibilityfromtheViewControllersPerspective.html - 移動VoiceOver光標到一個特定的元素)。試圖發佈LayoutChanged通知以及ScreenChangedNotifications我的樣品中,以及試圖與示例代碼(ListAdder - http://developer.apple.com/library/ios/#samplecode/ListAdder/Introduction/Intro.html,後者也使用NavigationController正如我們一樣),但是上面並沒有與樣品甚至工作。

任何想法,爲什麼?

+0

你試過'UIAccessibilityScreenChangedNotification'相反,你也可以嘗試移動的通知'的tableView:willDisplayCell:forRowAtIndexPath'? – jszumski

回答

0

我解決了這個問題,通過張貼屏幕改變通知。該調用的第二個參數是要選擇第一個單元格的表視圖的視圖。

UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification,[自nextTableViewController]視圖];