swift 快速奔跑的兔几 本节的内容是:tableView栗子

swift 快速奔跑的兔几 本节的内容是:tableView栗子,第1张

概述import UIKitclass MyFirstTableViewController: UITableViewController { var tableData = ["swift","fu萝卜","game","dance as you wish","summerTime"] var tableData2 = ["sunshine","sunset","sme
import UIKitclass 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栗子所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1082466.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存