Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我添加了一个工具栏,我正在向该工具栏添加一个按钮。无论我为该按钮设置的框架如何,该按钮都会自动向左对齐。我希望该按钮成为工具栏的中心。如何做到这一点?
在按钮左侧(和右侧)的选项卡栏中添加一个灵活的空间。
UIBarButtonItem *flexible = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
与按钮一起,在按钮的右侧和左侧添加一个灵活的空间项