在我的iPad应用程序中,我有一个UIViewController和一个打开modalView的按钮。如何在SWIFT中重新绘制我的视图?
@IBAction func showPostCommentViewController(sender: AnyObject){
let modalView = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("PostCommentViewController") as! PostCommentViewController
modalView.modalTransitionStyle = UIModalTransitionStyle.CoverVertical
modalView.modalPresentationStyle = UIModalPresentationStyle.FormSheet
modalView.delegate=self
self.presentViewController(modalView, animated: true, completion: nil)
}
当我关闭与dismissViewControllerAnimated的modalView,我想“刷新”我的视图控制器(因为我增添了新的内容)。但是,由于模式视图是“表单”样式,因此不会调用viewDidAppear或viewWillAppear。
我试图使用setNeedsDisplay,但它不起作用。
我不知道该怎么做。
你想怎么办? setNeedsDisplay可以更新布局和类似的东西,但标签的内容等不会改变,你必须明确地改变它们。你究竟想要做什么? – luk2302
您可以在“PostCommentViewController”中创建一个代理,该代理将在视图本身消失时创建。然后在被调用者处,您可以定义您想要执行的任何操作,并使用特定的代理 –