我遇到了一个问题,我的应用会冻结,如果当我按下它来获取下一个场景时,它将视图控制器与tableview嵌套在其中。该应用只会在声明该表有多少行时冻结。如果有人知道如何解决这个问题,不胜感激。IOS桌面问题
class ViewController: UIViewController, UITableViewDataSource {
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 5
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell = UITableViewCell()
cell.textLabel?.text = "hello"
return cell
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
你是什么意思的“应用程序将冻结”?它会崩溃吗?你有错误日志吗?或者它只是阻止用户界面? –
请您在发布问题时务必清楚。 “如果我按下它”,你是什么意思?按什么?除此之外,当您指定行数时,应用程序会冻结,但您必须指定行数。否则,该应用程序应该会给你一个运行时错误。所以,我相信你不想这么做。请说明你的意思。 – Natasha