UITableViewCell
에 단추를 추가하고 싶습니다. 이것은 내 코드입니다. 'UITableViewCell에 단추 추가
if (indexPath.row==2) {
UIButton *scanQRCodeButton = [[UIButton alloc]init];
scanQRCodeButton.frame = CGRectMake(0.0f, 5.0f, 320.0f, 44.0f);
scanQRCodeButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
scanQRCodeButton.backgroundColor = [UIColor redColor];
[scanQRCodeButton setTitle:@"Hello" forState:UIControlStateNormal];
[cell addSubview:scanQRCodeButton];
}`
이제 앱을 실행하면 빈 행만 표시됩니다. 어떤 아이디어?
'[cell.contentView addSubview : scanQRCodeButton];을 추가 한 후'[scanQRCodeButton release]; 버튼을 해제 할 수도 있습니다. – elprl
* ARC를 사용하지 않는 경우 – elprl