你如何在Objective-C中使用UILexicon?我发现Apple提供的文档非常无用.
它有什么作用?它会返回字典或正确的单词拼写吗?或者我提供像"hellllo"这样的单词,并将其与正确的拼写"Hello"匹配并将其作为字符串返回?
任何帮助,将不胜感激.
requestSupplementaryLexiconWithCompletion:
这是我的错误报告,但显然我会有错误,因为我完全猜测如何使用该函数,不知道块语句内部的内容(因为文档(当时)没有说!(Beta 4 docs) ))哈哈哈!

我在重新编码或电话呼叫期间iOS(真实)设备上的键盘扩展有问题(iOS模拟器没有红色状态栏).由于状态栏增加了20个点,自定义键盘也会在Y轴上移动20个点并将其减少height到196个点(应该是216个点).但是,当我打印时view.frame,会显示{{0.0,0.0},{320.0,196.0}}.
这是截图.
如果我使用故事板而不是以编程方式添加视图,它可以正常工作.首先我认为这是因为topLayoutGuide.length,但它在调试区域显示0.0.
我试图找到解决方案或与此问题相关的任何主题,但似乎我独自面对它.:(
有没有办法检测键盘类型的变化与大小,类型和建议栏高度,从英语键盘改为包含某种建议栏的印地语(见截图).
普通英语键盘
第一个问题
改为印地语LIPI后 - 当我改变时,everthing很好,因为英语和印地语键盘的大小相同,但在开始输入后印地语Lipi建议覆盖TextField
第二个问题
更改为表情符号 - 表情符号键盘高度与英语相比稍微多一点,所以再次键盘覆盖了TextField.
我最近升级到Xcode 8并将我的代码转换为Swift 3.我正在制作一个自定义键盘(扩展),它完美地运行到iOS 9,但我在iOS 10中遇到了一些问题.
问题:此按钮单击在iOS 10中不起作用,即用户未定向到设置.我在项目中配置了URL Schemes并尝试了以下代码:
@IBAction func btnGetStarted(_ sender: AnyObject) {
let settingsUrl = URL(string: UIApplicationOpenSettingsURLString)
if let url = settingsUrl {
UIApplication.shared.openURL(url)
}
}
Run Code Online (Sandbox Code Playgroud)
还尝试过:
@IBAction func btnGetStarted(_ sender: AnyObject) {
if let settingsURL = URL(string:"prefs:root=General&path=Keyboard/KEYBOARDS") {
UIApplication.shared.openURL(settingsURL)
}
}
Run Code Online (Sandbox Code Playgroud)
问题:当应用程序在iOS 10中运行时,不会弹出此Toast
吐司代码:
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath){
let pbWrapped: UIPasteboard? = UIPasteboard.general
if let pb = pbWrapped {
if currentKeyboard == XXXXXX.emoji {
if let data = UIImagePNGRepresentation(dataEmoji[(indexPath as NSIndexPath).row]) { …Run Code Online (Sandbox Code Playgroud) 我现在正在开发iOS 8自定义键盘扩展,还有一些我无法弄清楚的问题.
首先,我认为UITextInputDelegate方法没有按照我的预期运作.
这听起来是正确的:selectionWillChange:和selectionDidChange:方法应该当用户长时间打字印刷机区域叫什么名字?而textWillChange:和textDidChange:方法应该每当文字字面上改变被称为?
实际上,我观察到的是,当我在文本输入区域中更改选择textWillChange:并被textDidChange:调用时,我无法得到其他两种方法在什么条件下被调用的线索.如果有人知道这些委托方法的用法,请告诉我.
其次,我知道该playInputClick:方法可用于虚拟化自定义键盘中的键盘点击声.由于这适用于正常情况,我发现无法在iOS 8自定义键盘扩展中应用.我的应用程序包含一个键盘视图控制器,以及将子类UIView添加到此视图控制器的自定义视图.我的方法是UIInputViewAudioFeedback在此自定义视图中声明委托,enableInputClicksWhenVisible方法返回YES,[[UIDevice currentDevice] playInputClick]设置调用的类方法,然后在需要键盘声音的任何地方调用此方法:这根本不起作用.
我的方法有什么不对吗?如果有人成功使用playInputClick方法,请分享你的智慧.
谢谢
我正在制作一个customKeyboard,它具有删除按钮,用于删除文本和代码,即:
func addDelete() {
deleteButton = UIButton.buttonWithType(.System) as UIButton
deleteButton.setTitle(" Delete ", forState: .Normal)
deleteButton.sizeToFit()
deleteButton.setTranslatesAutoresizingMaskIntoConstraints(false)
deleteButton.addTarget(self, action: "didTapDelete", forControlEvents: .TouchUpInside)
deleteButton.layer.cornerRadius = 5
view.addSubview(deleteButton)
var rightSideConstraint = NSLayoutConstraint(item: deleteButton, attribute: .Right, relatedBy: .Equal, toItem: view, attribute: .Right, multiplier: 1.0, constant: -10.0)
var topConstraint = NSLayoutConstraint(item: deleteButton, attribute: .Top, relatedBy: .Equal, toItem: view, attribute: .Top, multiplier: 1.0, constant: +10.0)
view.addConstraints([rightSideConstraint, topConstraint])
}
func didTapDelete() {
var proxy = textDocumentProxy as UITextDocumentProxy
proxy.deleteBackward()
}
Run Code Online (Sandbox Code Playgroud)
但这很慢,因为我必须单击很多次才能从中删除很多字符textField。
有没有什么方法可以创建一个可以连续按下的按钮,它可以像默认的iPhone keyBoard backSpace按钮一样快地删除字符?
我正在使用十年前的Microsoft Keyboard Layout Creator 1.4创建自定义键盘。我已经在软件中验证了我的键盘,没有出现任何问题。我还测试了我的键盘(在软件中多次)以确保相应的基本键和换档键功能正常。但是,当我单击项目下的按钮时
“构建 DLL 和安装包”
我收到以下消息:
“构建键盘文件时出现问题。您想查看警告/错误信息吗?”
选择“是”后,我会看到以下内容:
CL.EXE returned 1
RC.EXE returned 1
LINK.EXE returned 1
Run Code Online (Sandbox Code Playgroud)
并且尝试创建键盘布局失败。
此外,“构建键盘文件时出现问题”消息会弹出 4 次。每次单击 yes 都会带来与上述相同的结果。
我是编码的菜鸟,不知道这意味着什么,除了所有 3 个程序都返回“否”。
这是我使用的软件的下载链接:https : //www.microsoft.com/en-us/download/confirmation.aspx? id = 22339(顺便说一句,点击它会自动下载软件)
我试图通过userInfo使用键盘扩展来获得键盘大小.
我加
NSNotificationCenter.defaultCenter().addObserver(self, selector: "keyboardWillShow:", name: UIKeyboardDidShowNotification, object: nil)
Run Code Online (Sandbox Code Playgroud)
在我的KeyboardViewController.swift中,但keyboardWillShow永远不会被调用.
我正在尝试为a创建自定义键盘UITextField.这不是系统扩展; 它只在我的应用程序中.
myTextField.inputView = CustomKeyboard()
Run Code Online (Sandbox Code Playgroud)
本CustomKeyboard类有子视图,并且需要比平常系统键盘多一点的高度自动布局约束.这会导致错误,因为系统正在添加必需的customKeyboard.height == 216约束.
我怎么告诉它不要添加这个约束?它被添加到了CustomKeyboards中的约束数组中superview.
(lldb) po type(of: self)
MyApp.CustomKeyboard
(lldb) po self.superview!.constraints[0]
<NSLayoutConstraint:0x17428ab40 MyApp.CustomKeyboard:0x100d37580.height == 216 (active)>
Run Code Online (Sandbox Code Playgroud) 在键盘扩展中找不到任何使用 SwiftUI 的示例。我创建了一个扩展,并尝试创建简单的扩展,SwiftUI Button无需任何操作(它只是打印调试文本)。但键盘上没有可见的按钮。是否可以创建 SwiftUI 自定义键盘?
struct SwiftUIButton: View{
let action: () -> ()
var body: some View{
Button(action: action){Text("Tap me")}
}
}
class KeyboardViewController: UIInputViewController {
@IBOutlet var nextKeyboardButton: UIButton!
//1.insert this: SwiftUIButton is a simple Button View
var swiftUIButtonView: SwiftUIButton!
//...
override func viewDidLoad() {
super.viewDidLoad()
// Perform custom UI setup here
//2. try to insert my SwiftUI View
let swiftUIButtonView = SwiftUIButton(action: {print("test")})
let vc = UIHostingController(rootView: swiftUIButtonView)
//I tried that with no success
//guard …Run Code Online (Sandbox Code Playgroud) custom-keyboard ×10
ios ×7
swift ×3
autolayout ×2
ios8 ×2
keyboard ×2
objective-c ×2
uikeyboard ×2
backspace ×1
emoji ×1
ios10 ×1
pc ×1
statusbar ×1
swift3 ×1
swiftui ×1
uilexicon ×1
uitextfield ×1
view ×1