【发布时间】:2017-11-06 09:49:29
【问题描述】:
我在Storyboard 中创建了一个UIViewController,其中包含一个UITableView。
class ViewController: UIViewController, UITableViewDataSource
{
@IBOutlet weak var tableView: UITableView!
override func viewDidLoad()
{
super.viewDidLoad()
}
override func viewDidAppear(_ animated: Bool)
{
super.viewDidAppear(animated)
print(self.tableView.subviews) //HERE..!!!
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
{
return 5
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
return tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
}
}
问题:我遇到了subViews 或UITableView 的问题。
在 iOS-10 中,当执行 tableView.subviews 时,我得到 UITableViewWrapperView 作为元素之一以及数组中的其他元素。
但在 iOS-11 中,UITableViewWrapperView 在tableView.subviews 返回的数组中不可用。
因此,我遇到了 hitTest:withEvent: 的问题,我已经覆盖了 UITableView。
【问题讨论】:
-
@PGDev
hitTest:withEvent:有什么问题?
标签: ios objective-c swift uitableview ios11