84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
navigationBar上面添加自定义leftBarbuttonItem和rightBarbuttonItem,自定义titleView的时候不能居中,根据leftBarbuttonItem的位置计算titleView的宽度和x还是位置还是不能居中,求大神解答
走同样的路,发现不同的人生
By default, set leftBarbuttonItem and rightBarbuttonItem, then set titleView, titleView is centered. If possible, you can send a screenshot of the code to help you find the problem.
估计是你计算错了吧
I encountered the same problem. After searching everywhere, there was no answer. Finally, I tried it out with code.
How to say:I added the following code after setting the custom titleView after ViewDidLoad:[self.navigationItem.titleView layoutIfNeeded];
By default, set leftBarbuttonItem and rightBarbuttonItem, then set titleView, titleView is centered. If possible, you can send a screenshot of the code to help you find the problem.
I encountered the same problem. After searching everywhere, there was no answer. Finally, I tried it out with code.
How to say:
I added the following code after setting the custom titleView after ViewDidLoad:
[self.navigationItem.titleView layoutIfNeeded];