UITableView, UITableView

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.