2011-08-24 8 views
0

タップされたときに私はUITableVieCellにアクセサリービューを動的に追加しています。セルのハイライトがaccessoryViewをブロックしているように見えます。別の表のセルをタップしてハイライトが消えるまで、私はacessoryViewを表示しません。表のセルのaccessoryViewをハイライトの上に表示する方法は?

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
    [tableView selectRowAtIndexPath:indexPath 
          animated:YES 
        scrollPosition:UITableViewScrollPositionNone]; 
    UITableViewCell* cell = [tableView cellForRowAtIndexPath:indexPath]; 
    cell.textLabel.text = @"Loading server stuff"; 

    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; 
    CGRect frame = CGRectMake(0.0, 0.0, 20, 10); 
    button.frame = frame; 
    button.backgroundColor = [UIColor redColor]; 
    cell.accessoryView = button; 
} 

答えて

0

セル内のすべてのビューの背景が入れ替わります。

- (void)setImage:(UIImage *)image forState:(UIControlState) 

こうすると、背景がスワップされますが、画像は上に残ります。

関連する問題