Remove form assistant from keyboard in iPhone standalone web app

后端 未结 3 2058
無奈伤痛
無奈伤痛 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条回答
  •  旧时难觅i
    2020-12-05 06:21

    You can do a category of UIView and "override" the behaviour of addSubview: like the example below. Call the method "exachangeMethods" from your applicationDidFinishLaunching of your AppDelegate.

    #import "UIView+util.h"
    #import 
    
    @implementation UIView (util)
    
    // Swaps our custom implementation with the default one
    // +load is called when a class is loaded into the system
    + (void) exchangeMethods
    {
        SEL origSel = @selector(addSubview:);
    
        SEL newSel = @selector(customAddSubview:);
    
        Class viewClass = [UIView class];
    
        Method origMethod = class_getInstanceMethod(viewClass, origSel);
        Method newMethod = class_getInstanceMethod(viewClass, newSel);
        method_exchangeImplementations(origMethod, newMethod);
    }
    - (void) customAddSubview:(UIView *)view{
    
        if( [[view description]rangeOfString:@"

提交回复
热议问题