出于安全原因,如果为登录字段启用了自定义键盘,我们希望显示警报。如果我使用以下代码
-(BOOL)application:(UIApplication *)application shouldAllowExtensionPointIdentifier:(NSString *)extensionPointIdentifier
{
if ([extensionPointIdentifier isEqualToString: UIApplicationKeyboardExtensionPointIdentifier])
{
return NO;
}
return YES;
}
如果我使用以下代码,它会在所有字段中禁用键盘。但我只想禁用几个字段。试图在if循环中保持警报,但它显示每个键盘的警报。我怎样才能实现它?
Apple不允许将自定义键盘用于Login等受保护字段。为此,只需勾选文本字段的“安全文本输入”框
为应用程序中的每个文本字段触发application:shouldAllowExtensionPointIdentifier:
方法。在您的代码中,没有条件检查要启用或禁用的特定文本字段。
要实现此功能,您必须从textFieldShouldBeginEditing:
获取tapped文本字段的引用,然后使用application:shouldAllowExtensionPointIdentifier:
中的引用启用或禁用自定义键盘。