Ios 在引导过程中删除行tableView
启动应用程序时,如何在启动tableView期间删除行? 我试着添加活动指示器,但他没有帮我 可能是我的UIView设置不正确,还是需要使用其他工具 可能需要代码活动指示器:Ios 在引导过程中删除行tableView,ios,swift,uitableview,uiactivityindicatorview,Ios,Swift,Uitableview,Uiactivityindicatorview,启动应用程序时,如何在启动tableView期间删除行? 我试着添加活动指示器,但他没有帮我 可能是我的UIView设置不正确,还是需要使用其他工具 可能需要代码活动指示器: private func setLoadingScreen() { let width: CGFloat = 30 let height: CGFloat = 30 let x = (self.tableView.frame.width / 2) - (width / 2) let y =
private func setLoadingScreen() {
let width: CGFloat = 30
let height: CGFloat = 30
let x = (self.tableView.frame.width / 2) - (width / 2)
let y = (self.tableView.frame.height / 2) - (height / 2) - (self.navigationController?.navigationBar.frame.height)!
loadingView.frame = CGRect(x: x, y: y, width: width, height: height)
self.activityIndicator.activityIndicatorViewStyle = .gray
self.activityIndicator.frame = CGRect(x: 0, y: 0, width: 30, height: 30)
self.activityIndicator.startAnimating()
loadingView.addSubview(self.activityIndicator)
self.tableView.addSubview(self.loadingView)
}
private func removeLoadingScreen() {
self.activityIndicator.stopAnimating()
}
最简单的解决方案是在加载之前将
UITableView
定义的separatorStyle
属性的值设置为uitableviewCellseparatorstyle
self.tableView.separatorStyle = .none
加载完成后,可以将其设置回UITableViewCellSeparatorStyleSingleLine
self.tableView.separatorStyle = .singleLine
设置空
UITableView
footer。在这种情况下,您不必切换回分隔符样式
self.tableView.tableFooterView = UIView()
或者将UITableView
分隔符样式设置为。无
self.tableView.separatorStyle = .none
我想在
UITableView
上为此创建一个扩展:
public extension UITableView {
/**
Hides the separators which display when the table view is empty.
*/
func hideSeparators() {
guard tableFooterView == nil else { return }
tableFooterView = UIView()
}
}
将tableview的分隔符样式设置为UITableViewCellSeparatorStyleNone。由于我没有考虑到这一点,因此)谢谢:)