[英]How to reload view controller on iOS
Is there a way to reload the view controller not through calling the method -viewDidLoad
? 有没有一种方法可以通过不调用
-viewDidLoad
方法来重新加载视图控制器? I was searching my problem in Google, and the Solutions found was to call to -viewDidLoad
and i want to reload the view controller, Like open the app at first. 我正在Google中搜索问题,发现的解决方案是调用
-viewDidLoad
,我想重新加载视图控制器,就像首先打开该应用程序一样。
how can I do that? 我怎样才能做到这一点?
You should never call -viewDidLoad
method directly. 您永远不要直接调用
-viewDidLoad
方法。 It's called automatically whenever your view controller's view loads for the first time. 每当您的视图控制器的视图第一次加载时,都会自动调用它。
As far as I can understand from provided description, what you're trying to achieve can be done using custom setup method in -viewDidLoad
and then calling it again later to "reload" your view controller. 据我从提供的描述中了解的,可以使用
-viewDidLoad
自定义安装方法来完成您要实现的-viewDidLoad
,然后稍后再次调用它以“重新加载”视图控制器。
- (void)viewDidLoad {
[super viewDidLoad];
[self setupViewController];
}
- (void)setupViewController {
// any custom setup you need to do
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.