繁体   English   中英

UIPickerView打开速度非常慢

[英]Very slow opening of UIPickerView

我有两个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个SECONDS。 然后我关闭它,它会更快打开。

BTW我在那里使用REALM对象DB,但我认为这不是问题。 它在故事板和Delegate +数据源中是连接的

我已经有相同的问题了很长一段时间了。 连接到Xcode时似乎是bug。

可以在此处找到此错误的其他实例:

祝你好运!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM