/ Published in: Objective C
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
- (void)textFieldDidBeginEditing:(UITextField *)textField { // add toolbar above keyboard UIToolbar *toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 44.0)]; toolBar.barStyle = UIBarStyleBlackTranslucent; // done button UIBarButtonItem *done = [[UIBarButtonItem alloc] initWithTitle:@"Fechar" style:UIBarButtonItemStyleBordered target:self action:@selector(closeKeyboard)]; UIBarButtonItem *space = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; [space release]; [done release]; textField.inputAccessoryView = toolBar; [toolBar release]; }