Skip to content

Instantly share code, notes, and snippets.

@shingohry
Last active August 29, 2015 14:06
Show Gist options
  • Save shingohry/6fc8033763608bb02995 to your computer and use it in GitHub Desktop.
Save shingohry/6fc8033763608bb02995 to your computer and use it in GitHub Desktop.
use textView inputAccessoryView
- (void)awakeFromNib
{
// Initialization code
self.textView.delegate = self;
UIToolbar *tipToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 50)];
tipToolbar.barStyle = UIBarStyleBlackOpaque;
tipToolbar.items = [NSArray arrayWithObjects:
[[UIBarButtonItem alloc] initWithTitle:@"Calculate"
style:UIBarButtonItemStyleBordered
target:nil
action:nil],
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
target:nil
action:nil],
[[UIBarButtonItem alloc] initWithTitle:@"Done"
style:UIBarButtonItemStyleBordered
target:nil
action:nil],
nil];
[tipToolbar sizeToFit];
self.textView.inputAccessoryView = tipToolbar;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment