I have a subclass of UIView that I added as a titleView for navigationItem using the following line of code:
self.navigationItem.titleView = tempview;
Simple enough. It works great. My problem is that this navigationItem sometimes updated by rightBarButton (sometimes there is no button, sometimes there is one standard size button, sometimes there is a big button).
I realized that I could just use the layoutSubviews method of the layoutSubviews class, which I added as titleView , so I put it in:
-(void)layoutSubviews { [super layoutSubviews]; self.mylabel.frame = self.bounds; }
This does not work, because when updating the rightBarButton element rightBarButton it does not change the correct header change.
I also noticed that borders do not grow, as soon as they become smaller, they just change position.
I tried using setNeedsLayout and layoutIfNeeded , but they just "resize" the view with the wrong borders.
I also made sure that the rightBarButton element rightBarButton set to zero, but the view is still not expanding correctly after compression.
Thanks for any help!
mjdth source share