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 6999533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:33:13+00:00 2026-05-27T20:33:13+00:00

I know there are plenty of other questions addressing the same problem, but since

  • 0

I know there are plenty of other questions addressing the same problem, but since I’m using a custom keyboard, I thought my problem would be slightly different.

This is the specific error:

-[EquationTextField element1Pressed:]: unrecognized selector sent to instance 0x4b68ee0
2012-01-02 12:23:44.630 rowQuiz[20975:207] Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[EquationTextField element1Pressed:]: unrecognized selector sent to instance 0x4b68ee0’

I have a view controller, quizController. Inside quizController is a custom view, textField (added through interface builder).

When textField is tapped, another custom view, formulaKeyboard, pops up as its keyboard. When a button on the keyboard is pressed, method element1Pressed: is called, and the error described above appears.

Some other questions say that there must be a problem with the retain count, so I tried retaining and releasing quizController in the app delegate, which didn’t solve the problem.

It is also possible that I hooked up something incorrectly in Interface Builder; For the custom keyboard, File’s owner and the main view are set to class elementKeyboard. For quizController, File’s owner is set to quizController and hooked up to it’s view.

Below is the code of the textField’s class.

EquationTextField.h

#import <UIKit/UIKit.h>
#import "FormulaKeyboard.h"


@interface EquationTextField : UIView <KeyInput> {

FormulaKeyboard *keyboard;
NSString *lastElement;
}

@property (readwrite, retain) UIView *inputView;

@end

EquationTextField.m

- (id)initWithCoder:(NSCoder *)coder {

self = [super initWithCoder:coder];
if (self) {

    self.userInteractionEnabled = YES;

    [self addGestureRecognizer:
     [[UITapGestureRecognizer alloc] initWithTarget:self
                                             action:@selector(becomeFirstResponder)]];


   NSArray *bundle = [[NSBundle mainBundle] loadNibNamed:@"FormulaKeyboard" owner:self options:nil];

    for (id object in bundle) {
        if ([object isKindOfClass:[FormulaKeyboard class]])
            keyboard = (FormulaKeyboard *)object;
    }   


    self.inputView = keyboard;
    keyboard.delegate = self;

}
return self;
}

- (BOOL)canBecomeFirstResponder {

return YES;
}

#pragma mark -- KeyInput Protocol Methods

- (void)addElement:(NSString *)elementName {


}

- (void)addCharge:(NSString *)chargeIncrease {


}

- (void) addState:(NSString *)stateName {

}

- (void)deleteCharacter {


}


- (void)dealloc
{
[super dealloc];
}

formulaKeyboard.h

#import <UIKit/UIKit.h>


@protocol KeyInput <UITextInputTraits>

- (void) addElement:(NSString*) elementName;
- (void) addCharge:(NSString*) chargeIncrease;
- (void) addState:(NSString*) stateName;
- (void) deleteCharacter;

@end

@interface FormulaKeyboard : UIView {

id <KeyInput> delegate; 
}

@property (nonatomic, retain) id <KeyInput> delegate;


-(IBAction) element1Pressed:(id)sender;
-(IBAction) element2Pressed:(id)sender;
-(IBAction) element3Pressed:(id)sender;
-(IBAction) element4Pressed:(id)sender;
-(IBAction) element5Pressed:(id)sender;
-(IBAction) element6Pressed:(id)sender;

-(IBAction) chargePlusPressed:(id)sender;
-(IBAction) chargeMinusPressed:(id)sender;

-(IBAction) solidSatePressed:(id)sender;
-(IBAction) liquidStatePressed:(id)sender;
-(IBAction) gasStatePressed:(id)sender;



@end

formulaKeyboard.m

- (IBAction)element1Pressed:(id)sender {

[delegate addElement:@"Na"];

}

- (void)element2Pressed:(id)sender {

[delegate addElement:@"N"];


}

- (void)element3Pressed:(id)sender {

[delegate addElement:@"O"];


}

- (void)element4Pressed:(id)sender {


}

- (void)element5Pressed:(id)sender {



}

- (void)element6Pressed:(id)sender {


}

appDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

quizController = [[QuizController alloc] initWithNibName:@"QuizController" bundle:nil];
[self.window addSubview:quizController.view];
[self.window makeKeyAndVisible];
return YES;
}

     - (void)dealloc
{
[_window release];
[quizController release];
[super dealloc];
}
  • 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-27T20:33:13+00:00Added an answer on May 27, 2026 at 8:33 pm

    The action of the keyboard’s buttons are pointing to the wrong place. You’ve probably got them wired to File’s Owner inside the FormulaKeyboard nib when they should be wired to the FormulaKeyboard object you’re creating inside the nib.

    NSArray *bundle = [[NSBundle mainBundle] loadNibNamed:@"FormulaKeyboard" owner:self options:nil];

    That’s being called from EquationTextField, so self would be your instance of EquationTextField. If you’re keyboard’s targets are pointing there, that’s why you get the unrecognized selector exception.

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

Sidebar

Related Questions

I know there are plenty of other questions ask about [indexPath row] and scrolling,
Probably there are a lot of similar questions around, but since I know only
I know there are plenty checkout plugins out there but to be honest -
I know there are a lot of similar questions on SF, but I think
I know there is a wiki page about it , but since I'm very
I know there are a lot of questions around on this subject, but I've
I know there are plenty of ways to run git on my server, but
NOTE: There are other questions related to this on SO, but none of them
I know there are plenty of tutorials about integrating C++ into Java, but whats
There are plenty of PHP frameworks out there as many of you know, 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.