Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> iOS

Tạo TableView bo góc (rounded corners) trong iOS

Các bước:

  1. Tạo project, thêm UITableView vào Storyboard.
  2. Tạo custom UITableViewCell class.
  3. Kết nối @IBOutlet, set delegate, dataSource.
  4. Implement UITableViewDataSource, UITableViewDelegate.
  5. Trong viewDidLoad bo góc cho tableView:
tableView.layer.cornerRadius = 10
tableView.layer.backgroundColor = UIColor.cyan.cgColor

Chạy app: TableView hiển thị bo tròn góc 10pt, nền cyan.