Typical use
Swift
let buttonBar = MDCButtonBar()
let actionItem = UIBarButtonItem(
title: "<# title #>",
style: .done, // ignored
target: self,
action: "<# selector #>"
)
buttonBar.items = [actionItem]
let size = buttonBar.sizeThatFits(self.view.bounds.size)
buttonBar.frame = CGRect(x: <# x #>, y: <# y #>, width: size.width, height: size.height)
self.view.addSubview(buttonBar)
Objective-C
MDCButtonBar *buttonBar = [[MDCButtonBar alloc] init];
UIBarButtonItem *actionItem =
[[UIBarButtonItem alloc] initWithTitle:@"<# title #>"
style:UIBarButtonItemStyleDone // ignored
target:self
action:@selector(<# selector #>)];
buttonBar.items = @[ actionItem ];
CGSize size = [buttonBar sizeThatFits:self.view.bounds.size];
CGPoint origin = CGPointZero;
buttonBar.frame = CGRectMake(origin.x, origin.y, size.width, size.height);
[self.view addSubview:buttonBar];