Remove form assistant from keyboard in iPhone standalone web app

后端 未结 3 2023
無奈伤痛
無奈伤痛 2020-12-05 05:16

Is it possible to remove the form assistant from the iPhone popup keyboard in a standalone web app? I know the general consensus is that it\'s not possible in Mobile Safari,

3条回答
  •  有刺的猬
    2020-12-05 06:05

    If you app is a web app wrapped in a native Objetive-C app this is possible by manipulating Keyboard views.

    first, register to receive the keyboardDidShow notification:

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil];
    

    this will call the following method when keyboard shows up:

    -(void)keyboardDidShow:(NSNotification*)notif
    {
        NSArray *array = [[UIApplication sharedApplication] windows];
    
        for (UIWindow* wind in array) {
            for (UIView* currView in wind.subviews) {
                if ([[currView description] hasPrefix:@"

    this method goes over the views on screen looking for the form assistant and hiding it.

    NOTE: Apple probably won't reject this, as i've seen it being used by Facebook etc, but this technique might break in upcoming iOS releases.

提交回复
热议问题