I don’t know any Objective-C, that is why I’m using PhoneGap to create an iOS app. There is a big flaw in PhoneGap for iOS. The keyboard constantly has the form assistant (the ‘next’, ‘previous’ and ‘done’ buttons.) There is very little information on the web on how to get rid of this, all of the Stackoverflow questions about it said it was practically impossible. But after a while I stumbled upon this tutorial. The bottom paragraph tells you how to do it. And it works, I downloaded and tested the finished app.
But since I have no idea how to do almost anything in Xcode, or in Objective-C, I have no idea what files the two sections of code go into, he doesn’t say in the tutorial.
Can anyone tell me where in the PhoneGap apps files it goes? I’d appreciate it massively, this has been bugging me all day.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
And this
RichTextEditorViewController *viewController = [[RichTextEditorViewController alloc] initWithNibName:@"RichTextEditorViewController" bundle:nil];
self.viewController = [[UINavigationController alloc] initWithRootViewController:viewController];
Also this
- (void)removeBar {
// Locate non-UIWindow.
UIWindow *keyboardWindow = nil;
for (UIWindow *testWindow in [[UIApplication sharedApplication] windows]) {
if (![[testWindow class] isEqual:[UIWindow class]]) {
keyboardWindow = testWindow;
break;
}
}
// Locate UIWebFormView.
for (UIView *possibleFormView in [keyboardWindow subviews]) {
// iOS 5 sticks the UIWebFormView inside a UIPeripheralHostView.
if ([[possibleFormView description] rangeOfString:@"UIPeripheralHostView"].location != NSNotFound) {
for (UIView *subviewWhichIsPossibleFormView in [possibleFormView subviews]) {
if ([[subviewWhichIsPossibleFormView description] rangeOfString:@"UIWebFormAccessory"].location != NSNotFound) {
[subviewWhichIsPossibleFormView removeFromSuperview];
}
}
}
}
}
Thank you!
I have come across the need to do this myself. I am an IOS developer, but needed to use phonegap to keep costs down for multiplatform dev.
Anyway, i fixed your code. As, i guess, you dont want to spend your time learning obj-c, you just need to replace the contents of your MainViewController.m with the following:
As a word of warning, this is a bit of a hacky solution (but then so is using phonegap!), and may break in future versions of iOS. But i guess we fix that when it comes to it…