我正在使用 Swift 5、Xcode 11 和 ui 表视图控制器创建一个简单的应用程序。在 ui 表视图中,我想要 2 个按钮:一个按钮在我的表视图左侧,另一个在右侧。我尝试了许多其他相关/类似问题的答案,但都失败了(可能是因为 1. 太旧了,2. 用 OBJ-C 编写的答案)。
这是我的表视图控制器:
import UIKit
@objcMembers class CustomViewController: UITableViewController {
var tag = 0
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewDidAppear(_ animated: Bool) {
}
override func numberOfSections(in tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
// 3
override func tableView(_ …Run Code Online (Sandbox Code Playgroud)