ios - 如何将用户输入的数据插入本地 html 文档
问题描述
我对 Swift 很陌生,我正在为一个简单的任务而苦苦挣扎。我制作了一个简单的应用程序,它将启动一个本地 HTML 文件。
我现在想添加一个出现的文本框,询问用户“输入 IP 地址”。然后,该文本将被插入到 HTML 文件的 3 个不同位置。
有人对此有任何想法吗?或者知道一个可能有一些与这个想法相关的教程的好网站?到目前为止,这是我的代码:
import UIKit
import WebKit
class ViewController: UIViewController {
@IBOutlet weak var htmlload: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let htmlpath = Bundle.main.path(forResource: "index", ofType: "html")
let url = URL(fileURLWithPath: htmlpath!)
let request = URLRequest(url: url)
htmlload.load(request)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
解决方案
推荐阅读
- excel - 如何引用另一个工作表中的单元格
- postgresql - 如何从 SELECT 创建 INSERT 日志?
- java - 在 Mockito 中绕过静态方法
- swiftui - SwiftUI 通过将 NavigationLink 标记设置为 nil 来解除视图
- python - 无法在 pyenv 中导入 tkinter,在 mac 上安装了 python 3.8.6
- telegram - 获取电报群ID
- php - 选择距离内的 MySQL 结果(以英里为单位);结果不正确
- ios - PageTabViewStyle 显示列表,而不是轮播
- c# - Visual Studio SQL Server 数据库“如果更新则复制”仍然每次都替换数据库
- spring - 为什么 h2-console 默认数据库名称与 application.properties 文件中定义的数据库名称不匹配?