I use navigation with a custom subclass UIViewthat becomes my titleView. I want it to be the full width available.
Logically from mine UIViewController viewWillAppear:, this should be:
CGFloat width = self.width - self.navigationItem.leftBarButtonItem.width - someConstant;
(There is no required item here.)
This would then adapt to various possible widths leftBarButtonItem. The trap is that it leftBarButtonItemis equal nil, therefore leftBarButtonItem.widthalways 0 (well, in any case, in the simulator).
backBarButtonItem also equal to zero.
What should I do instead?
source
share