Question

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;

}
Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top