Aligning UIToolbar items

by alex 30. May 2009 11:58

//Add two UIBarButtonSystemItemFlexibleSpace items to your toolbar, to the left and right of your items

 

UIBarButtonItem *flexibleSpaceLeft = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];

UIBarButtonItem *flexibleSpaceRight = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];

[toolbar setItems:[NSArray arrayWithObjects:flexibleSpaceLeft, settingsButton,deleteButton,aboutButton, flexibleSpaceRight, nil]];

[flexibleSpaceLeft release];

[flexibleSpaceRight release];

 

//Adding these as you would any other toolbar items will distribute space evenly between the two of them.

Currently rated 4.7 by 3 people

  • Currently 4.666667/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

General

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen