gpt4 book ai didi

ios9 - Xcode 7 - Swift - 键盘在模拟器中正确显示但在实际设备上不正确

转载 作者:行者123 更新时间:2023-11-28 06:55:02 25 4
gpt4 key购买 nike

我遇到了一个不寻常的问题,即键盘正确响应模拟器中的输入焦点操作(禁用硬键盘),但是当我在实际设备上构建和测试时,键盘没有出现。

该应用程序是一个简单的 SFSafariViewController。我是否需要在 Info.plist 或类似的东西中指定键盘设置?

-----更新-----

添加源代码:

import UIKit
import SafariServices

class ViewController: UIViewController
{
private var urlString:String = "https://example.com"

override func viewDidLoad()
{
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}

override func viewDidAppear(animated: Bool) {

super.viewDidAppear(animated)

// This will remove the status (battery, time, etc) bar
UIApplication.sharedApplication().statusBarHidden = true

let svc = SFSafariViewController(URL: NSURL(string: self.urlString)!)

// Kind of a hack, in that we really aren't removing the navbar
// Rather we are adjusting the starting point of the vpc object so it appears as the navbar is hidden
self.presentViewController(svc, animated: true) {

var frame = svc.view.frame
let OffsetY: CGFloat = 42

frame.origin = CGPoint(x: frame.origin.x, y: frame.origin.y - OffsetY)
frame.size = CGSize(width: frame.width, height: frame.height + OffsetY)
svc.view.frame = frame
}
}

override func didReceiveMemoryWarning()
{
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}

最佳答案

呃。作为 ios 开发的新手,我 100% 确定我的代码很糟糕,这导致键盘不出现。因此,今天早上我创建了一个测试项目,并将项目中的每一行代码添加到测试项目中,以查看是哪个代码导致了感知到的损坏。

所有代码加回来后,我重新编译了一遍测试工程,果然成功了。与普通项目完全相同的代码,wtf?所以后来我意识到一定有一些缓存异常导致了这个问题,果然我找到了这个 post关于如何清除 Xcode 缓存。清除缓存后,我重新加载我的项目,重新编译,果然,我的项目按预期运行。

简而言之,如有疑问,请清除缓存。

关于ios9 - Xcode 7 - Swift - 键盘在模拟器中正确显示但在实际设备上不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33877085/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com