UITableView Swift不滚动Swift

Sru*_*dam 1 uitableview swift

UITableView Swift不滚动.伙计我有这个表视图有三个不同的单元格,表格视图在模拟器上渲染就好了但是当我滚动它时立即跳回到顶部.

导入UIKit

class WalkthroughScreen2ViewController: UIViewController , UITableViewDataSource,UITableViewDelegate {

    @IBOutlet weak var tableView: UITableView!

    override func viewDidLoad() {
        super.viewDidLoad()


        tableView.estimatedRowHeight = 300
        tableView.rowHeight = UITableViewAutomaticDimension
        tableView.scrollEnabled = true

        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        // Return the number of rows in the section.
        return 4
    }
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) ->
        UITableViewCell {

            println(indexPath.row)
            if(indexPath.row == 0){

                var cell: wkscreen2Cell1TableViewCell = tableView.dequeueReusableCellWithIdentifier("Cell1") as wkscreen2Cell1TableViewCell

                return cell
            }
            if(indexPath.row == 1){

                var cell: wkscreen2Cell2TableViewCell = tableView.dequeueReusableCellWithIdentifier("Cell2") as wkscreen2Cell2TableViewCell

                return cell
            }
            if(indexPath.row == 2){
                println("cell3")
                var cell: wkscreen2Cell3TableViewCell = tableView.dequeueReusableCellWithIdentifier("Cell3") as wkscreen2Cell3TableViewCell

                return cell
            }
            return UITableViewCell()

    }




}
Run Code Online (Sandbox Code Playgroud)

Ujj*_*ani 6

我找到了你的问题,因为我有同样的问题.

要在模拟器中滚动,请按下并上下移动光标.如果你仍然无法滚动,那一定是个bug.