How to show the Previous / Next / Finish panel with a UITextView

I saw the Previous / Next / Ready panel above the keyboard when entering text in web view on iPhone. I want to use this built-in bar in an application that I do in conjunction with a UITextView. In several applications, I saw a very similar bar above the keyboard. I assume that this is either some kind of manual bar that just looks like the bar I need, or the programmer figured out how to display the actual bar. assuming it is an actual bar, not a manual bar, how can you display it?

+3
source share
3 answers

There is no built-in Prev / Next / Done panel, you have to create it yourself.

CM. ALSO:

+3
+3

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;
        }
}
+1
source

Source: https://habr.com/ru/post/1753609/


All Articles