nui icon indicating copy to clipboard operation
nui copied to clipboard

Style is not applied to Button in UITableViewCell

Open trombini opened this issue 11 years ago • 1 comments

Hi

I try to apply a custom style to a button in a UITableViewCell if the button is pressed. Kind of like a radiobutton we know from HTML. However, the style is never applied. although i can change the Title of the button.

- (void)buttonPressed:(id)sender event:(id)event{
    NSSet *touches = [event allTouches];
    UITouch *touch = [touches anyObject];
    CGPoint currentTouchPosition = [touch locationInView:self.tableView];
    NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:currentTouchPosition];

    FileProtectionCell *cell = (FileProtectionCell*)[self.tableView cellForRowAtIndexPath:indexPath];
    [cell.button setTitle:@"active" forState:UIControlStateNormal];
    cell.button.nuiClass = @"LargeButton";
    [NUIRenderer renderButton:cell.button];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    if(indexPath.section == kSectionProtection){
        FileProtectionCell *cell = (FileProtectionCell*)[tableView dequeueReusableCellWithIdentifier:@"FileProtectionCell"];
        [cell.button addTarget:self action:@selector(buttonPressed:event:) forControlEvents:UIControlEventTouchUpInside];
        return cell;
    }
    return nil;
}

can somebody verify this? is this a known issue?

trombini avatar Aug 22 '13 12:08 trombini

I have seen something similar with UITextViews. I am looking into it.

phatmann avatar Jan 18 '14 09:01 phatmann