Nils
Nils

Reputation: 1507

UITextView next and previous Button over the Keyboard

how can I implement "Next" and "Previous" Button's over the keyboard. I use UITextView and with click on "Next" the Next TextView gets focus, Previous the last TextView.

I do not found any tutorial on the Internet.

I hope everybody can help me.

Upvotes: 2

Views: 2083

Answers (2)

Mitul Marsoniya
Mitul Marsoniya

Reputation: 5299

change BSKeyboardControls.m file & make the following Changes

remove this one

// [self setRightArrowButton:[[UIBarButtonItem alloc] initWithBarButtonSystemItem:106 target:self action:@selector(selectNextField)]];

add this

        [self setRightArrowButton:[[UIBarButtonItem alloc]initWithTitle:@"Next" style:UIBarButtonItemStylePlain target:self action:@selector(selectNextField)]];

Upvotes: 0

user1673099
user1673099

Reputation: 3289

Please use this custom control

COCOA

If you need any help, let me know.

This controlis very simple to use.

Updated Answer

Change the Button Label

Go to BSKeyboardControls.m file & make the following Changes

On line no. 42

 [self setSegmentedControl:[[UISegmentedControl alloc] initWithItems:@[ NSLocalizedStringFromTable(@"<", @"BSKeyboardControls", @"Previous button title."),
                                                                               NSLocalizedStringFromTable(@">", @"BSKeyboardControls", @"Next button title.") ]]];

On line No. 51

   [self setDoneButton:[[UIBarButtonItem alloc] initWithTitle:NSLocalizedStringFromTable(@"Ok", @"BSKeyboardControls", @"Done button title.")
                                                         style:UIBarButtonItemStyleDone
                                                        target:self
                                                        action:@selector(doneButtonPressed:)]];

///// ********* Update 2 ********* //////////// SET Image for Previous & Next

Just add the following code in BSKeyboardControls.m after line no. 52

    [self.segmentedControl setImage:[UIImage imageNamed:@"add.png"] forSegmentAtIndex:BSKeyboardControlsDirectionPrevious];
    [self.segmentedControl setImage:[UIImage imageNamed:@"add.png"] forSegmentAtIndex:BSKeyboardControlsDirectionNext];

Upvotes: 1

Related Questions