UITableView, UITableView
1. Differences between cell view and contentView
1.1 addSubView
You can add a subview to a UITableViewCell instance in either of the following ways: [cell addSubview: view] or [cell. contentView addSubview: view]. Generally, there is no difference between the two methods. However, if you select multiple edit statuses, the child views directly added to the cell will not move, but the child views added to the contentView will move to the right as a whole. Therefore, we recommend that you use [cell. contentView addSubview: view] to add a subview.
1.2 backGroundColor cell. backgroundColor = [UIColor grayColor]; or cell. contentView. backgroudColor = [UIColor grayColor]; generally, the two methods have the same effect. However, in the multi-choice editing status, directly setting the cell background color ensures that the background color of the left-side multi-choice box is consistent with the cell background color, while setting the contentView background color, the background color of the left-side multiple-choice box will be the background color of UITableView or the parent view background color of UITableView. To ensure the color consistency, you must set the background color of the cell instead of the cell. contentView.