0

I'm using setInputAccessoryView method to add a done button like in the picture below above the keyboard. However, the button shows up very ugly. So, I need your help to programmatically create the same button (color,button type).

enter image description here

Here's my current code:

btDone = [[UIButton alloc] initWithType:UIButtonTypeRoundedRect];
[btDone setFrame:CGRectMake(85.0f,0.0f,80.0f,40.0f)];
[btDone setTitle:@"Done"];
[btDone setTitleColor:whiteColor];
[btDone setBackgroundColor:blueColor];

Thx for helping,

Stephane

Stephane
  • 4,978
  • 9
  • 51
  • 86

1 Answers1

3

If that black translucent bar is a UIToolBar, then you should add a UIBarButtonItem. The initializer function should be initWithBarButtonSystemItem:target:action: where the first parameter is UIBarButtonSystemItemDone and the target being the object dealing with the action and the action the selector that it should execute.

Sergio Campamá
  • 746
  • 1
  • 7
  • 14