&tag(UIKit/テーブル); *目次 [#sc69111a] #contents *関連ページ [#pe99027a] *参考情報 [#w10c3f1c] *UITableViewを使って実装(ストーリーボード) [#o41cfc7a] -該当するViewControllerをデータソース、Delegate先とする場合、以下のようになる。 #pre{{ class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { @IBOutlet weak var tableView: UITableView! var objects = ["まぐろ", "サーモン", "えび", "はまち", "いか", "うなぎ"] override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. self.navigationItem.rightBarButtonItem = self.editButtonItem() tableView.backgroundColor = UIColor.grayColor() } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return objects.count } func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "myCell") cell.textLabel?.text = objects[indexPath.row] cell.backgroundColor = UIColor.brownColor() return cell } override func setEditing(editing: Bool, animated: Bool) { super.setEditing(editing, animated: animated) tableView.setEditing(editing, animated: animated) } } }}