大佬教程收集整理的这篇文章主要介绍了swift 快速奔跑的兔几 本节的内容是:tableView栗子,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
import UIKit class MyFirstTableViewController: UITableViewController { var tableData = ["swift","fu萝卜","game","dance as you wish","summerTime"] var tableData2 = ["sunshine","sunset","smell of grass"] override func viewDidLoad() { super.viewDidLoad() // Uncomment the following line to preserve SELEction between presentations // self.cleaRSSelectionOnViewWillAppear = false // Uncomment the following line to display an Edit button in the navigation bar for this view controller. // self.navigationItem.rightBarButtonItem = self.editButtonItem() } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } // MARK: - Table view data source override func numberOfSectionsInTableView(tableView: UITableView) -> Int { return 2 } override func tableView(tableView: UITableView,numberOfRowsInSection section: int) -> Int { if (section==0){ return tableData.count }else{ return tableData2.count } } override func tableView(tableView: UITableView,cellForRowATindexPath indexPath: NSIndexPath) -> UITableViewCell { let sectionNum = indexPath.section var StringForTableCell = "" if(sectionNum==0){ let cell1 = tableView.dequeueReusableCellWithIdentifier("StringCell1",forIndexPath: indexPath) as UITableViewCell StringForTableCell = tableData[indexPath.row] cell1.textLabel?.text = StringForTableCell return cell1 }else{ let cell2 = tableView.dequeueReusableCellWithIdentifier("StringCell2",forIndexPath: indexPath) as UITableViewCell StringForTableCell = tableData2[indexPath.row] cell2.textLabel?.text = StringForTableCell return cell2 } } }
以上是大佬教程为你收集整理的swift 快速奔跑的兔几 本节的内容是:tableView栗子全部内容,希望文章能够帮你解决swift 快速奔跑的兔几 本节的内容是:tableView栗子所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。