I set the titleView
of a view controller to a UISlider
like so in viewDidLoad
:
UISlider *slider = [UISlider new];
self.navigationItem.titleView = slider;
The desired outcome is that the slider takes the full width of the title view. This is working fine when the view is loaded in the wider landscape mode. The slider adjust its size as expected when rotating to portrait mode.
However, when the view is loaded in the narrower portrait mode and then the device is rotated to landscape, the slider does not grow in width to make use of the newly available size.
Why is that so and how can it get the desired outcome as described?
After viewDidLoad
:
After rotating: