In oc, add a custom line above the input method and add several buttons



Note that this method should be used with caution, because once it is written in one place, the floating window defined here will appear when the keyboard pops up in all other interfaces, but as a reminder, this method still needs to be posted

- (UIView *)inputAccessoryView {
    UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 30)];
    [button setTitle:@"按钮" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
    button.backgroundColor = [UIColor redColor];

    UIView *containerView = [UIView new];
    containerView.frame = CGRectMake(0, 0, 10, 60);
    containerView.backgroundColor = [UIColor greenColor];
    [containerView addSubview:button];

    return containerView;
}

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326927564&siteId=291194637