Reputation: 595
i've seen a "Previous/Next/Done" bar above the keyboard when entering text in a webview on an iPhone. i want to use this built in bar in an app that i'm making in conjunction with a UITextView. i have seen a very similar looking bar above the keyboard in several apps. my guess is this is either some hand made bar that just looks like the bar i want or the programmer figured out a way to show the actual bar. assuming its the actual bar and not a hand made bar how do you get it to display?
Upvotes: 3
Views: 3509
Reputation: 11
Create this method and call it on ViewWillLoad:
- (void) keyboardToolbarSetup
{
if(self.keyboardToolbar==nil)
{
self.keyboardToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 44)];
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:@"Cancel" style:UIBarButtonItemStylePlain target:self action:@selector(anyAction)];
UIBarButtonItem *extraSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:self action:@selector(anyOtherAction)];
NSArray *toolbarButtons = [[NSArray alloc]initWithObjects:cancelButton,extraSpace,doneButton, nil];
[self.keyboardToolbar setItems:toolbarButtons];
self.myTextView.inputAccessoryView=self.keyboardToolbar;
}
}
Upvotes: 1
Reputation: 26583
I wrote XCDFormInputAccessoryView which is an input accessory view with previous/next/done buttons.
Upvotes: 3
Reputation: 113370
There's no built-in Prev/Next/Done bar, you have to create it yourself.
SEE ALSO:
Upvotes: 3