I have designed a view with a toolbar that appears modally in Interface Builder. I have a UIBarButtonItem that is on the left hand side, which I would like to appear on the right hand side of the toolbar. How can I do this in IB, or via code?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- back button text does not change
相关文章
- 现在使用swift开发ios应用好还是swift?
- Could I create “Call” button in HTML 5 IPhone appl
- TCC __TCCAccessRequest_block_invoke
- xcode 4 garbage collection removed?
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
- How can I add media attachments to my push notific
- How do you detect key up / key down events from a
Insert an item which has identifier being "flexible space".
(source: xanga.com)
Swift Code:
Swift 3.x or above:
Output:
- one item in the right like this
-two items left and right like this
-three items like this
-four items like this
so when you want to add a space you must add the flexible bar button.
If you can get away with this not being a UIBarButtonItem (for example, an info button), what I do is change the layer of the button to always be in front of the Toolbar. This way, when I drag the button over the toolbar in IB it doesn't automatically suck it in and over to the left side.
Here's how to do it in code if anyone comes across this post: