come il tasto aggiungi sulla tastiera è possibile aggiungere anche vista come muggito ...
Trova notizie finestra della tastiera e quindi impostare cornice del pulsante e anche yourView e quindi aggiungere alla tastiera
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardDidShow:)
name:UIKeyboardDidShowNotification
object:nil];
return YES;
}
- (void)keyboardDidShow:(NSNotification *)note {
UIButton *returnBtn = [UIButton buttonWithType:UIButtonTypeCustom];
returnBtn.frame = CGRectMake(0,-25,320,25);
returnBtn.adjustsImageWhenHighlighted = NO;
returnBtn.backgroundColor=[UIColor darkGrayColor];
returnBtn.titleLabel.textColor=[UIColor whiteColor];
[returnBtn setBackgroundImage:[UIImage imageNamed:@"keyBtn.png"] forState:UIControlStateNormal];
[returnBtn addTarget:self action:@selector(keyboardBtn:) forControlEvents:UIControlEventTouchUpInside];
// locate keyboard view
UIWindow* tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1];
UIView* keyboard;
for(int i=0; i<[tempWindow.subviews count]; i++) {
keyboard = [tempWindow.subviews objectAtIndex:i];
// keyboard found, add the button
if([[keyboard description] hasPrefix:@"<UIPeripheralHost"] == YES)
// if (txtTag==5) {
[keyboard addSubview:returnBtn];
}
}
-(IBAction)keyboardBtn:(id)sender{
UIWindow* tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1];
UIView* keyboard;
for(int i=0; i<[tempWindow.subviews count]; i++) {
keyboard = [tempWindow.subviews objectAtIndex:i];
// keyboard found, add the button
if([[keyboard description] hasPrefix:@"<UIPeripheralHost"] == YES)
// if (txtTag==5) {
[keyboard addSubview:yourView];// here add your view with frame
}
}
spero che questo aiuto si ...
:)
fonte
2012-10-04 06:48:56
hai qualche esempio di app che fanno questo? – Jessedc