我用present(),为什么弹出的tableview的大小不是CGSize的大小?

import UIKit


class XuanListController: UITableViewController {


    var menusArr:Array<(String,String?)> = [("saoyisao", "扫一扫"), ( "SignRule",  "标记")]

    

    override func viewDidLoad() {

        super.viewDidLoad()


        clearsSelectionOnViewWillAppear = false

        preferredContentSize = CGSize(width: 320, height: 44)

         tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell)

    }

   

    override func didReceiveMemoryWarning() {

        super.didReceiveMemoryWarning()

        // Dispose of any resources that can be recreated.

    }


    // MARK: - Table view data source


    override func numberOfSections(in tableView: UITableView) -> Int {

        // #warning Incomplete implementation, return the number of sections

        return 1

    }


    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

        // #warning Incomplete implementation, return the number of rows

        return menusArr.count

    }


    

    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

        let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)

        let (languageNames, languageCode) = menusArr[indexPath.row]

        cell.textLabel?.text = languageCode

        cell.imageView?.image = UIImage(named: languageNames)


        // Configure the cell...


        return cell

    }

}


qq_诱惑不止_0
浏览 1034回答 0
0回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

iOS