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

  • Home
  • SEARCH
  • 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 964247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:47:47+00:00 2026-05-16T01:47:47+00:00

I make a keyboard from UIButtons. On this keyboard there are 49 UIButtons, which

  • 0

I make a keyboard from UIButtons. On this keyboard there are 49 UIButtons, which create the following:


- (void)viewDidLoad {

    [self emoticonButtonOnTheKeyBoard_xCoordinate:0   yCoordinate:0 Emoticone_name:@"emoticon_angel.gif"        backString:@"O:-)"      keyboardView:self.view];
    [self emoticonButtonOnTheKeyBoard_xCoordinate:40  yCoordinate:0 Emoticone_name:@"emoticon_angry.gif"        backString:@":-@"       keyboardView:self.view];
    [self emoticonButtonOnTheKeyBoard_xCoordinate:80  yCoordinate:0 Emoticone_name:@"emoticon_big_smile.gif"    backString:@":-D"       keyboardView:self.view];
    [self emoticonButtonOnTheKeyBoard_xCoordinate:120 yCoordinate:0 Emoticone_name:@"emoticon_confused.gif"     backString:@":-s"       keyboardView:self.view];
    [self emoticonButtonOnTheKeyBoard_xCoordinate:160 yCoordinate:0 Emoticone_name:@"emoticon_cool.gif"         backString:@"B)"        keyboardView:self.view];
    [self emoticonButtonOnTheKeyBoard_xCoordinate:200 yCoordinate:0 Emoticone_name:@"emoticon_cry.gif"          backString:@":,-("      keyboardView:self.view];
    [self emoticonButtonOnTheKeyBoard_xCoordinate:240 yCoordinate:0 Emoticone_name:@"emoticon_disappoint.gif"   backString:@":-|"       keyboardView:self.view];
    [self emoticonButtonOnTheKeyBoard_xCoordinate:280 yCoordinate:0 Emoticone_name:@"emoticon_emo.gif"          backString:@"(Emo)"     keyboardView:self.view];

}

and the creating methods:


- (IBAction) updatingTheTextFiledWithEmoticon
{
    iPhoneClientDevAppDelegate *appDelegate = (iPhoneClientDevAppDelegate *)[[UIApplication sharedApplication] delegate];
    [[appDelegate.personalchatviewcontrollerReference message_textfield] setText:[[[appDelegate.personalchatviewcontrollerReference message_textfield] text] stringByAppendingString:appDelegate.EmoticonCurrentButtonValue]];
}

- (void) emoticonButtonOnTheKeyBoard_xCoordinate:(int)x_coordinate yCoordinate:(int)y_coordinate Emoticone_name:(NSString *)emoticon_name
                                       backString:(NSString *)stringback keyboardView:(UIView *)keyboard
{
    iPhoneClientDevAppDelegate *appDelegate = (iPhoneClientDevAppDelegate *)[[UIApplication sharedApplication] delegate];
    appDelegate.EmoticonCurrentButtonValue = stringback;
    UIButton* emticon_button = [UIButton buttonWithType:UIButtonTypeCustom];
    emticon_button.frame = CGRectMake(x_coordinate, y_coordinate, 40, 43);
    [emticon_button setImage:[UIImage imageNamed:emoticon_name] forState:UIControlStateNormal];
    [emticon_button setImage:[UIImage imageNamed:emoticon_name] forState:UIControlStateHighlighted];
    [emticon_button setBackgroundImage:[UIImage imageNamed:@"background.png"] forState:UIControlStateNormal];
    [emticon_button ]
    [keyboard addSubview:emticon_button];


    [emticon_button addTarget:nil action:@selector(updatingTheTextFiledWithEmoticon)  forControlEvents:UIControlEventTouchUpInside];
}

So, I successfully covered the keyboard, but I have a big problem.
When I press a button on the keyboard, the application always return the last created button value.
How can I distinguish the UIButtons?

Thanks!

  • 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-16T01:47:47+00:00Added an answer on May 16, 2026 at 1:47 am

    Give them a unique .tag property (type int), and make sure your selector takes the sender as an argument:

    -(IBAction)buttonPressed:(id)theButton
    {
        NSLog("Button %d pressed",[theButton tag]);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

UITextView doesn't inherit from UIControl, so there are not addTarget:forControlEvent: methods possible. I used
From the android tutorial : pass_text.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode,
I'm using C (gcc) and ncurses, to make a program that will be monitoring
I'm am writing a piece of software in C++ that controls the keyboard backlight
I'm new to windows programming (any win 32 API). I want to create a
I'm using the UISearchBar (but not the SearchDisplayController that's typically used in conjunction) and
I have a layout that uses an EditText to let users search a database
In my JTable I have a number of actions that can accessed via popup
G'day guys, I'm building an application that allows users to rapidly input numbers into
I have a page that needs to do two things at once: Listen all

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.