Swift версия:
let toolbar = UIToolbar(frame: CGRectMake(0, 0, viewController.view.frame.size.width, 35.0))
let flexibleSpace = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.FlexibleSpace, target: viewController, action: nil)
let button1 = UIBarButtonItem(title: "A", style: UIBarButtonItemStyle.Plain, target: viewController, action: foo)
let button2 = UIBarButtonItem(title: "B", style: UIBarButtonItemStyle.Plain, target: viewController, action: bar)
let button3 = UIBarButtonItem(title: "C", style: UIBarButtonItemStyle.Plain, target: viewController, action: blah)
toolbar.items = [button1, flexibleSpace, button2, flexibleSpace, button3]