I have a custom titleView that I need to set the max width for. That would be the screen width - width of left item (back title, button or nil) - width of right item (button or nil). How can I determine this?
Thanks.
_segmentedControl.frame = CGRectMake(0, 0, CGFLOAT_MAX, _segmentedControl.frame.size.height);
[self.navigationItem setTitleView:_segmentedControl];
Setting CGFLOAT_MAX as width for the navigationItem title view use the maximum space available between the left item and the right item.
Doesn't the navigationbar set the width to its maximum automatically? I mean, I'm sure the sizeThatFits: method of your custom titleView is called. Maybe this is a good starting point.
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