단추를 tableview에 추가하려고하는데 단추를 지정할 프레임이 보이지 않더라도. 이것은 사용자 정의 UITableViewCell이며 xib 파일 대신 코드에 단추를 추가하는 것이므로 단추를 클릭하고 didSelectRowAtIndexPath가 아닌 작업을 수행 할 수 있습니다. cellForRowAtIndexPath에 다음 코드가 있습니다. 있어야 할 곳에 없는?UITableView subview to uitableviewcell
UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
button.frame = bframe;
button.userInteractionEnabled = YES;
[button addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
[cell.contentView addSubview:button];
return cell;
너무 길지 않은 경우 cellForRowAtIndexPath에 전체 코드를 표시하십시오. 버튼을 감추고있는 셀에 어떤 다른 컨트롤이 추가 되었습니까? cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton 및 accessoryButtonTappedForRowWithIndexPath를 사용하지 않는 이유는 무엇입니까? – DyingCactus
감사합니다. UITableViewCellAccessoryDetailDisclosureButton 및 accessoryButtonTappedForRowWithIndexPath를 사용하여 작동하게했습니다. 회신에 감사드립니다. – Dave