I've got the following code in a detail view controller:
- (void)viewWillLayoutSubviews {
[super viewWillLayoutSubviews];
[self configureView];
}
When I segue to this view controller with a breakpoint on first line of -configureView
, it appears that [self configureView]
is called twice. However:
[self configureView]
in the above code, it's hit zero times. -configureView
does not call itself recursively.-configureView
is only called in the above code.From Apple's documentation:
The viewWillLayoutSubviews method is also called after the view is resized and positioned by its parent.
Given viewWillLayoutSubviews
is called whenever the bounds
change on the controller's view, there's no guarantee that it'll be invoked once only. It'll be called whenever rotation occurs for example.
Your configureView
method is probably better called from somewhere else, perhaps in viewWillAppear
, viewDidAppear
or even a custom mutator for BirdDetail
item as per Hermann's suggestion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With