PhoneGap的iOS6​​的:妥善解决删除形式助手栏(preV,接下来,完成) [英] Phonegap iOS6: Proper solution to Remove form assistant bar (prev, next, done)

查看:229
本文介绍了PhoneGap的iOS6​​的:妥善解决删除形式助手栏(preV,接下来,完成)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

另一个如何删除pre,下一步,完成按钮-question的你可能会认为的。没有真正实际。我做了一些比较深入的研究就这个问题和尝试了不同的方法,但没有一种方法或解决方案似乎真的把事情做对。所有的解决方法(这是它们是什么)提及,如下图所示基本相同的方法,替换MainViewController.m的内容文件。我很清楚地知道,或多或少所有这些提出的解决方案是有点哈克,但仍然应该有人在那里谁已经解决了这个问题,既优雅又深刻的思想一点点,或某人谁知道ç好,可以提出更加坚实的解决方案。

Another "how to remove the pre, next, done button" -question you may think. Not really actually. I've done some rather thorough research on this and tried out different approaches but no method or solution really seems to do it right. All workaround (that's what they are) mentioned and shown below are basically the same approach, replace content of the MainViewController.m file. I'm well aware of that more or less all these proposed solutions are somewhat hacky but still, there should be someone out there who has tackled this issue with a little bit of grace and deep thought, or someone who knows C well and can propose a more solid solution.

请允许我通过一些提出的解决方案引用来说明我的观点:

Allow me to illustrate my point by making references to some proposed solutions:

在iOS6的,这导致在形式助手栏边框仍在present 并充当如果表单助手栏还在那里键盘。

In iOS6, this results in the form assistant bar border still being present and the keyboard acting as if the form assistant bar were still there.

有人提出了一个解决方案上面,但我根本无法得到它的工作。回答者已经提出了若干修改和意见后只使更难把握做什么的地方。我试过他的解决方案的所有版本,但我总是最后的得到一个严重错误并在项目根本的不会编译

Someone proposed a solution to the above but I simply cannot get it to work. The answerer has made several edits and comments to the post which only make harder to grasp what to do where. I've tried all variations of his solution but I always end up getting a critical error and the project simply wont compile.

不是C程序员(这就是为什么我使用PhoneGap的),所以不能得到这个正常工作。不知道的添加什么,其中

Not a C programmer (that's why I use phonegap) so can't get this to work properly. Don't know what to add where.

不知道在哪里以及如何实现这种所以还没有尝试过。我应该在哪里注册接​​收keyboardDidShow通知?我应该在哪里添加功能?

Don't know where and how to implement this so haven't tried it. Where should I register to receive the keyboardDidShow notification? Where should I add the function?

根据我的研究,如果你愿意,还没有人提出这个妥善的解决办法。因此,有没有人成功删除的形式助手没有任何的上述副作用?

According to my research, if you will, no one has yet proposed a proper solution to this. So has anyone successfully removed the form assistant without any of the above mentioned side effects?

推荐答案

在这里你去,我在一个应用程序,我目前正在开发用这个。手指穿过它得到了应用商店,虽然对其他黑客,它使商店这是没有比别人差下去,因此应该站在一个公平的机会。

Here you go, I'm using this in an app I'm currently developing. Fingers crossed that it gets to the app store, although going on other 'hacks' that make it to the store this is no worse than others, so should stand a fair chance.

没有讨厌的副作用,用此方法 - 它删除干净通过确保它从来没有在第一时间创建了吧。ただ!

No annoying side effects with this method - it cleanly removes the bar by making sure it's never created in the first place. Ta da!

幸得 https://gist.github.com/2048571 ,这是他的code用小修复。

Credit goes to https://gist.github.com/2048571, this is his code with a small fix.

#import <objc/runtime.h>
#import <UIKit/UIKit.h>

@interface UIWebView (HackishAccessoryHiding)
@property (nonatomic, assign) BOOL hackishlyHidesInputAccessoryView;
@end

@implementation UIWebView (HackishAccessoryHiding)

static const char * const hackishFixClassName = "UIWebBrowserViewMinusAccessoryView";
static Class hackishFixClass = Nil;

- (UIView *)hackishlyFoundBrowserView {
    UIScrollView *scrollView = self.scrollView;

    UIView *browserView = nil;
    for (UIView *subview in scrollView.subviews) {
        if ([NSStringFromClass([subview class]) hasPrefix:@"UIWebBrowserView"]) {
            browserView = subview;
            break;
        }
    }
    return browserView;
}

- (id)methodReturningNil {
    return nil;
}

- (void)ensureHackishSubclassExistsOfBrowserViewClass:(Class)browserViewClass {
    if (!hackishFixClass) {
        Class newClass = objc_allocateClassPair(browserViewClass, hackishFixClassName, 0);
        IMP nilImp = [self methodForSelector:@selector(methodReturningNil)];
        class_addMethod(newClass, @selector(inputAccessoryView), nilImp, "@@:");
        objc_registerClassPair(newClass);

        hackishFixClass = newClass;
    }
}

- (BOOL) hackishlyHidesInputAccessoryView {
    UIView *browserView = [self hackishlyFoundBrowserView];
    return [browserView class] == hackishFixClass;
}

- (void) setHackishlyHidesInputAccessoryView:(BOOL)value {
    UIView *browserView = [self hackishlyFoundBrowserView];
    if (browserView == nil) {
        return;
    }
    [self ensureHackishSubclassExistsOfBrowserViewClass:[browserView class]];

    if (value) {
        object_setClass(browserView, hackishFixClass);
    }
    else {
        Class normalClass = objc_getClass("UIWebBrowserView");
        object_setClass(browserView, normalClass);
    }
    [browserView reloadInputViews];
}

@end

这篇关于PhoneGap的iOS6​​的:妥善解决删除形式助手栏(preV,接下来,完成)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆