how to Reaload viewDidLoad in a method , Not call again such as [self viewDidLoad ];
18,507
Solution 1
Instead of calling viewDidLoad:
make another method (newMethod
) and move all the code in it that needs to be called then from
- (void)viewDidLoad{
[super viewDidLoad];
[self newMethod];
}
Then from your code where you want to call viewDidLoad:
call
[self newMethod];
Swift version
func viewDidLoad() {
super.viewDidLoad()
self.newMethod()
}
Then from your code where you want to call viewDidLoad:
call
self.newMethod()
Solution 2
Copy all code in - (void)viewDidLoad then paste in viewWillAppear
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
//paste your viewDidLoad codes
}
Solution 3
Yes you can call from any method but if you post your scenario then it is better to reply
[self viewDidLoad];
Author by
Samina Shaikh
I am a sweet girl. I work at Apps Innovations Services Private Limited.
Updated on June 07, 2022Comments
-
Samina Shaikh almost 2 years
i want to reload ViewdidLoad in a method But now want to call again like [self viewDidLoad ];
is this possible?