Ocelot
Ocelot

Reputation: 1753

iOS keyboard with next, previous and done buttons, for text fields in UITableView

I have a UItableview with custom cells containing textfield. In the table view I have 5 rows, with the custom cell. I would like to implement the accessory view (Next, previous, Done buttons) for the text fields loaded in the tableview. Please help.

Code:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 5;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *simpleTableIdentifier = @"CPMyTableViewCell";

    CPMyTableViewCell *cell = (CPMyTableViewCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];

    if (cell == nil) {
        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CPMyTableViewCell" owner:self options:nil];
        cell = [nib objectAtIndex:0];
    }


    cell.textVw.placeholder = @"text";
    return cell;

}

Upvotes: 0

Views: 742

Answers (1)

Satyarth Kumar Prasad
Satyarth Kumar Prasad

Reputation: 26

You can use BSKeyboardControls https://github.com/SimonBS/BSKeyboardControls.

Through this it is very easy to add the controls to a keyboard. You can also find example in the project.

Also have a look at this

Upvotes: 1

Related Questions