这里我主要是以我做过的来举例说明:

QuestionnaireViewController是开始答问卷页,QuestionnaireOptionViewController是问卷答题目页.

 

首先,在答题目页,添加常量:

static let TAG = "QuestionnaireOptionViewController"
static let TAG_BREAK = "QuestionnaireOptionViewControllerBreak"

重写

override func didMoveToParentViewController(parent: UIViewController?){
  if isfinishQuestion {
    NSNotificationCenter.defaultCenter().postNotificationName(QuestionnaireOptionViewController.TAG, object: nil)
  } else {
    NSNotificationCenter.defaultCenter().postNotificationName(QuestionnaireOptionViewController.TAG_BREAK, object: nil)
  }
}

再在开始答问卷页,这个方法里,添加:

override func viewDidLoad() {
  super.viewDidLoad()
  NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(updateView), name: QuestionnaireOptionViewController.TAG, object: nil)
  NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(updateViewBreak), name: QuestionnaireOptionViewController.TAG_BREAK, object: nil)

}

func updateView() {
  beginResponse.setTitle("已完成答题", forState: UIControlState.Normal)
  beginResponse.enabled = false
  beginResponse.backgroundColor = UIColor(red: 216/255, green: 216/255, blue: 216/255, alpha: 1)
}
func updateViewBreak() {
  beginResponse.setTitle("继续答题", forState: UIControlState.Normal)
  beginResponse.backgroundColor = UIColor(red: 233/255, green: 30/255, blue: 99/255, alpha: 1)
}

注意,在此页面还要写deinit,销毁监听:

deinit {
  NSNotificationCenter.defaultCenter().removeObserver(self)
}

 

这样,当答题目页操作有什么变化,返回上一页面就可以知道其变化.