Note that there are some explanatory texts on larger screens.

plurals
  1. POdistinguish the UI buttons on the iphone
    primarykey
    data
    text
    <p>I make a keyboard from UIButtons. On this keyboard there are 49 UIButtons, which create the following:</p> <pre><code> - (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]; } </code> </pre> <p>and the creating methods:</p> <pre> <code> - (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]; } </code> </pre> <p>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?</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload