Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6348629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:27:28+00:00 2026-05-24T21:27:28+00:00

I am implementing a custom keyboard in my app. I want the keyboard to

  • 0

I am implementing a custom keyboard in my app. I want the keyboard to be applicable to multiple ‘types’ of textFields (all numeric, but some that can have negative values vs strictly positive, some whole-numbers vs some decimal values). I want to accomplish this by hiding one or two buttons depending on the ‘type’ of textField.

I have built the keyboard, and can assign it as the inputView of one of my textFields (xValue).
I have also written a method in my keyboard’s ViewController that takes integers as inputs and should modify the keyboard buttons. At the moment, this method works in the viewDidLoad method of my ViewController, but I want to call this from the ViewController class where the keyboard is initialised. When I do try to call it, the hidden properties aren’t changing.

In the viewDidLoad of the ViewController that contains my text field I have put the following:

DCKeyboard *dckvc = [[DCKeyboard alloc] initWithNibName:@"DCKeyboard" bundle:nil];
[dckvc modifyKeyboardType:0 doneNextValue:0];    // Has no effect
xValue.inputView = dckvc.view;

and in DCKeyboard.m I have defined:

@synthesize doneNextButton;
@synthesize decimalButton;
@synthesize posNegButton;

-(void) modifyKeyboardType:(int)buttonTypeNumber doneNextValue:(int)doneNextNumber {

    switch (buttonTypeNumber) {
    case 0:      // Case 0: All buttons available
        decimalButton.hidden = NO;
        posNegButton.hidden = NO;
        break;
    case 1:      // Case 1: No decimal button
        decimalButton.hidden = YES;
        posNegButton.hidden = NO;
        break;
    case 2:      // Case 2: No positive/negative button
        decimalButton.hidden = NO;
        posNegButton.hidden = YES;
        break;
    case 3:      // Case 3: No decimal or positive/negative button
        decimalButton.hidden = YES;
        posNegButton.hidden = YES;
        break;
    default:
        break;
    }

    switch (doneNextNumber) {
    case 0:      // Case 0: Done
        [doneNextButton setImage:[UIImage imageNamed:@"DoneButton.png"] forState:UIControlStateNormal];
        [doneNextButton setImage:[UIImage imageNamed:@"DoneButtonDown.png"] forState:UIControlStateHighlighted];
        break;
    case 1:      // Case 1: Next
        [doneNextButton setImage:[UIImage imageNamed:@"NextButton.png"] forState:UIControlStateNormal];
        [doneNextButton setImage:[UIImage imageNamed:@"NextButtonDown.png"] forState:UIControlStateHighlighted];
        break;
    default:
        break;
    }
}

When I try to call this as above, the

As mentioned above, if I call this from DCKeyboard’s viewDidLoad method as follows, then it works – so I’m confident that I’ve set everything up correctly and the code works. I must just be missing a fundamental concept!

- (void)viewDidLoad {
    [super viewDidLoad];

    [self modifyKeyboardType:3 doneNextValue:1]; // This works
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:27:29+00:00Added an answer on May 24, 2026 at 9:27 pm

    The underlying views may not be created until actually needed. In this case, that’s when you access the property dckvc.view. As such, when you call your modifyKeyboardType:doneNextValue: method, none of the views actually exist to be hidden.

    You could either defer this call until you’re sure the views are loaded, or cache the values you pass in for the keyboard type, using them in a viewDidLoad override to update the keyboard.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm implementing a custom control that inherits from Control . I want it to
I'm currently implementing a custom MultiPageEditorPart where I want to have multiple pages when
I'm implementing a custom TextView and I want to do some action when the
I'm struggling implementing a custom validator in my Android app. I want to show
I am implementing a custom collection implementation that can either be readonly or non-readonly;
I'm looking for some pointers on implementing Custom Events in VB.NET (Visual Studio 2008,
Implementing a custom membership provider, there are certain properties such as MinRequiredPasswordLength that only
I'm implementing a custom control with some labels on it and I need to
I'm implementing custom behavior sub-classing the form controls, but I cannot manage to access
I'm implementing a Custom Workflow and Activities to be reused in multiple projects and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.