开发者

PhoneGap Iphone Apps, Touch pad contains additional Bar

开发者 https://www.devze.com 2023-02-16 18:28 出处:网络
I have created a i phone app using phoneGAP.When i tested my app in my ipod, there is a additional bar found at the top of touch pad(it containsbuttons like Done,previous,next).But it is not found on

I have created a i phone app using phoneGAP.When i tested my app in my ipod, there is a additional bar found at the top of touch pad(it contains buttons like Done,previous,next).But it is not found on the apps that开发者_开发技巧 created using objective C.Anybody know how i removed this bar.

Thanks,


The form assistant (prev, next, done) bar can be removed by using a somewhat hacky but working solution. This of course assumes you use phonegap. It simply cannot be done in a regular web app / web page.

Replace the contents of your MainViewController.m with this:

#import "MainViewController.h"

@implementation MainViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
 {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
    // Custom initialization
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
}
return self;
}

- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];

// Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
 {
 [super viewDidLoad];
// Do any additional setup after loading the view from its nib.
 }

 - (void)viewDidUnload
 {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}

  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

 {

// Return YES for supported orientations
return [super shouldAutorotateToInterfaceOrientation:interfaceOrientation];
 }

- (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];
            }
        }
    }
}
}

- (void)keyboardWillShow:(NSNotification*) notification {
// remove the bar in the next runloop (not actually created at this point)
[self performSelector:@selector(removeBar) withObject:nil afterDelay:0];
}

@end
0

精彩评论

暂无评论...
验证码 换一张
取 消