2013-08-06 49 views
2

解决:的UIButton在TableViewCell VoiceOver的辅助

我跟着更新的链接,现在的UITableViewCell的按钮工作的VoiceOver。

现状:

我执行的VoiceOver辅助功能的应用程序。 我有一个自定义的UITableViewCell(下面的代码),可以在用户单击单元格时在展开和常规视觉(选择vs未选定)之间切换。根据我的设计,所有涉及扩展的工作都是如此 在自定义的UITableViewCell中,我有一个UILabel和2个UIButton。 UILabel被VoiceOver辅助功能识别,但UIButton被忽略。

问题:

我需要的VoiceOver的辅助功能,以识别UIButtons和阅读他们的无障碍标签和/或提示。

验证码:

-(id) init{ 
    ... 
    _leftButton = [UIButton buttonWithType:UIButtonTypeCustom]; 
    _rightButton = [UIButton buttonWithType:UIButtonTypeCustom]; 
    [_leftButton.titleLabel setFont:[UIFont fontWithName:FONT size:12]]; 
    [_rightButton.titleLabel setFont:[UIFont fontWithName:FONT size:12]]; 
    [_leftButton addTarget:self action:@selector(clickButtonLeft:) forControlEvents:UIControlEventTouchUpInside]; 
    [_rightButton addTarget:self action:@selector(clickButtonRight:) forControlEvents:UIControlEventTouchUpInside]; 

    [_leftButton setFrame:CGRectMake(CELL_DETAILS_SIDE_PADDING, 
           CELL_PADDING + CELL_NORMAL_HEIGHT + CELL_EXPANDED_PADDING - CELL_BUTTON_HEIGHT-7, 
           70, CELL_BUTTON_HEIGHT)]; 
    [_leftButton setImage:[UIImage imageNamed:@"giftIcon.png"] forState:UIControlStateNormal]; 
    [_leftButton setTitle:@" Gift This" forState:UIControlStateNormal]; 

    [_rightButton setFrame:CGRectMake(self.frame.size.width - 140 - CELL_DETAILS_SIDE_PADDING, 
            CELL_PADDING + CELL_NORMAL_HEIGHT + CELL_EXPANDED_PADDING - CELL_BUTTON_HEIGHT-7, 
            140, CELL_BUTTON_HEIGHT)]; 
    [_rightButton setImage:[UIImage imageNamed:@"buyPack.png"] forState:UIControlStateNormal]; 
    [_rightButton setTitle:@" Buy For Yourself" forState:UIControlStateNormal]; 

    _description = [[UILabel alloc] initWithFrame:CGRectMake(CELL_DETAILS_SIDE_PADDING, CELL_PADDING+CELL_NORMAL_HEIGHT+10, 
                 self.frame.size.width - 2*CELL_DETAILS_SIDE_PADDING, 50)]; 
    _description.numberOfLines = 0; 
    [_description setLineBreakMode:NSLineBreakByWordWrapping]; 
    [_description setFont:[UIFont fontWithName:FONT size:13]]; 
    [_description setBackgroundColor:[UIColor clearColor]]; 
    [_description setTextColor:[UIColor whiteColor]]; 
} 

- (void) expandCell 
{ 
    ... 
    [self addSubview:_description]; 
    [self addSubview:_leftButton]; 
    [self addSubview:_rightButton]; 
} 

UPDATE:

它看起来像什么描述here是要走的路。

回答