Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 未触发动态类型通知_Ios_Swift_Accessibility_Textkit - Fatal编程技术网

Ios 未触发动态类型通知

Ios 未触发动态类型通知,ios,swift,accessibility,textkit,Ios,Swift,Accessibility,Textkit,我目前正在使用Swift进行开发,遇到了动态键入的问题。我已经设置了这个代码 import Foundation import UIKit class ExerciseController :UIViewController, UITableViewDataSource, UITableViewDelegate { @IBOutlet var exerciseTableView :UITableView override func viewDidLoad() { super

我目前正在使用Swift进行开发,遇到了动态键入的问题。我已经设置了这个代码

import Foundation
import UIKit

class ExerciseController :UIViewController, UITableViewDataSource, UITableViewDelegate {

  @IBOutlet var exerciseTableView :UITableView

  override func viewDidLoad() {
    super.viewDidLoad()
  }

  override func viewWillAppear(animated: Bool)  {
    NSNotificationCenter.defaultCenter().addObserver(self, selector: "reload", name: UIContentSizeCategoryDidChangeNotification, object: nil)
  }

  override func viewWillDisappear(animated: Bool) {
    NSNotificationCenter.defaultCenter().removeObserver(self, name: UIContentSizeCategoryDidChangeNotification, object: nil)
  }

  func reload() {
    println("reload")
  }

  func numberOfSectionsInTableView(tableView: UITableView!) -> Int {
    return 1
  }

  func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int {
    return 1
  }

  func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
    let cellIdentifier = "ExerciseCell"
    var cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier) as? UITableViewCell
    if !cell {
      cell = UITableViewCell(style: .Default, reuseIdentifier: cellIdentifier)
    }
    cell!.textLabel.text = "Hello"
    cell!.textLabel.font = UIFont.preferredFontForTextStyle(UIFontTextStyleHeadline)
    return cell
  }
}
我运行我的应用程序,然后转到设置应用程序修改文本大小,但通知选择器没有被调用,也不知道为什么。提前感谢您解决此问题,非常感谢您的帮助

*以前的通知设置为viewDidiLoad和deinit,但也不起作用

更新#1

我用键盘通知做了同样的尝试,它确实起了作用。这意味着应用程序在完成编辑1时无法识别文本大小的变化

Apple已确认我的错误报告并将其与另一个错误报告合并


我做了一些测试,发现这个问题/bug只在iOS 8模拟器和
UIContentSizeCategoryDidChangeNotification
中普遍存在。其他通知按预期工作,iOS 7模拟器中的
UIContentSizeCategoryDidChangeNotification
运行正常。我已经在雷达上提交了一份错误报告。希望在不久的将来,这能为有这个问题的人澄清

编辑2


这个问题现在似乎已经解决了。此外,从Big Nerd Ranch可以真正简化设置动态类型的整个过程。

在黑暗中拍摄,请尝试
@objc(reload)func reload(){
很抱歉,它不起作用。它似乎不是选择器,但应用程序没有收到文本大小操作的通知。我能够在XCode 6中复制您的问题。然后我在实际的单元上尝试了它,它工作正常,所以它一定是XCode中的一个错误,将在稍后修复。@AJ_1310我知道这已经有一段时间了,但请查看以下日期:-)