我有两个 VC。一个作为 navigationController,另一个作为模态视图。 我正在使用 segue 来显示模态视图。
dispatch_async(dispatch_get_main_queue(), { () -> Void in
self.performSegueWithIdentifier("openFilterSegue", sender: nil)
});
然后打开这样的东西
class FilterVC: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource, AlertMessage {
override func viewDidLoad() {
pickerView.dataSource = self
pickerView.delegate = self
}
func pickerView(pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusingView view: UIView!) -> UIView {
let pickerLabel = UILabel()
pickerLabel.textColor = UIColor.blackColor()
pickerLabel.text = arrShopCentrum[row].nazev
pickerLabel.font = UIFont(name: "Roboto-Regular", size: 15)
pickerLabel.textAlignment = NSTextAlignment.Center
return pickerLabel
}
func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return arrPlace.count
}
}
当我第一次打开该 VC 时,加载大约需要 3 秒。然后我关闭它,它会打开得更快。
顺便说一句,我在那里使用了一个 REALM
对象数据库,但我认为这不是问题所在。
它在 storyboards 和 Delegate + datasource 是相连的
最佳答案
关于ios - 打开 UIPickerView 非常慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36721379/