ios - 打开 UIPickerView 非常慢

标签 ios swift 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 秒。然后我关闭它,它会打开得更快。

顺便说一句,我在那里使用了一个 REALM 对象数据库,但我认为这不是问题所在。 它在 storyboards 和 Delegate + datasource 是相连的

最佳答案

同样的问题我已经有一段时间了。连接到 Xcode 时似乎是错误。

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

祝你好运!

关于ios - 打开 UIPickerView 非常慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36721379/

相关文章:

objective-c - iOS - 在一台设备上支持多个用户帐户的应用程序中的可再生应用程序内购买

ios - 如何计算与 NSFetchRequest 中特定列值的关系?

ios - 游戏设计+快速协调跨场景功能

ios - 比较uipickerdate和当前日期

xcode - 如果我单击 UITextField,如何使 UIPickerView 出现?

ios - 在 iOS 中取消帐户与 Dropbox 的链接

ios - RealmSwift/Object.swift + 顶层不允许使用表达式

objective-c - 根据匹配来自 coredata 的字符串选择 UIPickerview

ios - PushViewController 在 httpPost 之后不起作用

ios - 当对象存在时获取 EXC_BAD_ACCESS