swift - Change Spacing Between UIBarButtonItems in iOS 8 -


I have UINavigationItem on my view controller , and I am Trying to reduce the space between my two rightbuttton button . Here are some of my code:

  // lets create two UIBarButton item1: UIBarButtonItem = UIBarButtonItem (customView: view1) to Item 2: UIBarButtonItem = UIBarButtonItem (customView: view2) var certain space: UIBarButtonItem = UIBarButtonItem (BarButtonSystemItem: UIBarButtonSystemItem.FixedSpace, goal: zero action: zero) fixedSpace.width = -20.0 // navigation bar add the burn button right on the scene. Controller NavigationalTime Raitbrtontam = [Item 2, the lower the space, item 1]  

As can be seen, I am using a Fiksdspes UIBarButtonItem , but it The difference is not changing for any reason. I or I can do UINavigationItem or UIBarButtonItem thought about subclassing I set accordingly to that space, but I can override to change me Space between items

Any information about solving this problem would be greatly appreciated! Thanks for the help of Fogmester, I felt that view1 and

View 2 objects, which are UIButtons , was also huge. So there was an unusual difference between them. Here is my last code:

  // View the first button image var image 1Img: UIImage = UIImage (Named: "Image1")! // See the first button var 1: UIButton = UIButton (frame: CGRect (x: 0, y: 0, width: view1Img.size.width, height: view1Img.size.height)) // get the second button image var View 2 IMG: UIImage = UIImage (Named: "Image2")! // See other button var 2: UIButton = UIButton (frame: CGRect (X: 0, Y: 0, Width: View2Imgksizekwidth, Height: View2Imgksizekheight)) // Create two UIBarButton items 1 to: UIBarButtonItem = UIBarButtonItem (customView: view1) Item 2: UIBarButtonItem = UIBarButtonItem (customView: view2) // set the 26px of fixed location between two UIBarButtonItems var fixedSpace: UIBarButtonItem = UIBarButtonItem (barButtonSystemItem: UIBarButtonSystemItem.FixedSpace, Target: Zero, Action: Zero) Set FixedSpace.width = 26.0 // Set -7px is two fixed locations before UIBarButton so that they are aligned with edges negative negatives: Space: UIBarButtonItem = UIB arButtonItem (barButtonSystemItem: UIBarButtonSystemItem.FixedSpace, goal: zero action: zero) negativeSpace.width = -7.0 // navigation bar Add to Burton button right on the scene. Controller Navigation Itam Right Bertname = [Negative Space, Item 2, Fixed Space, Item 1]  

I create the first UIButton followed by the background image and then the UIButton Use its size to create frames for Code> After that, I made a fixed space of 26px and after that -7.0px fixed space The purpose of the former is to create a fixed space between the two buttons. The purpose of the latter is to move all UIBarButtonItems to the right; Then, I add UIBarButtonItems like rightBarButtonItems in a particular order, so I think I want to see that.

It now works great! Thanks for all the help, Fogmeister!


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -