如何重新启动或重置视图控制器



所以我正在以编程方式制作一个交互式故事,我想要一种重新启动游戏的方法。(即清除所有内容(我唯一找到的是

func refreshView() ->() {
// Calling the viewDidLoad and viewWillAppear methods to "refresh" the VC and run through the code within the methods themselves
self.viewDidLoad
self.viewWillAppear
}
func refreshVC(sender: AnyObject) {
self.refreshView()
}

除了上面写着"表达式解析为一个未使用的函数"有人知道解决这个问题的方法吗?

viewDidLoadviewWillAppear之后缺少()

编辑:好的,添加括号将使您的代码编译。但在实际查看后,听起来真正想做的是在视图上调用setNeedsDisplay(),这将导致整个视图重新显示。

最新更新