我需要将B项相对于工具栏居中。我在界面构建器中创建了以下内容:
它可以正常工作,直到我动态插入其他项目:
如何保持B项的居中位置?一个想法是使用“固定间距栏按钮项”,但是我不能这样做,因为工具栏的长度也会随着不同方向的变化而改变。
![Item B in the center](https://istack.dev59.com/gzAGr.webp)
![Item B not in the center](https://istack.dev59.com/fCArQ.webp)
//lets be tabBar the big view and buttonB the.. well, button B
[buttonB setCenter:CGPointMake(tabBar.frame.size.height/2, tabBar.frame.size.width/2);
center
属性。你的代码将无法工作。 - Noah Witherspoon