Programmatically UITableView using swift

前端 未结 4 1623
广开言路
广开言路 2020-12-30 00:59

I\'m trying to create a simple tableView programmatically using swift, so I wrote this code on \"AppDelegate.swift\" :

    func application(application: UIA         


        
4条回答
  •  一个人的身影
    2020-12-30 01:41

    Cell Function Use:

    override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell!{
    
        var cell = tableView.dequeueReusableCellWithIdentifier(kLCellIdentifier) as UITableViewCell!
        if !cell {
            cell = UITableViewCell(style:.Default, reuseIdentifier: kLCellIdentifier)
        }
        cell.backgroundColor = UIColor.clearColor()
        cell.textLabel.text = arrData[indexPath.row]
        cell.image = UIImage(named: "\(arrImage[indexPath.row])")   
        cell.accessoryType  = UITableViewCellAccessoryType.DetailDisclosureButton
        cell.selectionStyle = UITableViewCellSelectionStyle.None
        return cell
    }
    

提交回复
热议问题