2012-11-14 161 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]视图];