Как добавить салфетки и заголовок в контроллер uiTableView.?
Я добавил один вид заголовка и салфетки влево для просмотра таблицы контроллера.
Как вы можете видеть на скриншоте, когда я прокручиваю строку, тогда заголовок также перемещается, пожалуйста, помогите мне.
мой код, чтобы добавить заголовок является
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let header = tableView.dequeueReusableCell(withIdentifier: "HeaderCell") as! CustomHeaderTableViewCell
header.SortButton?.backgroundColor = UIColor(netHex:0xEEEEEE)
header.FilterButton?.backgroundColor = UIColor(netHex:0xEEEEEE)
header.SortButton?.font = UIFont.fontAwesome(ofSize: 18)
header.SortButton?.text = String.fontAwesomeIcon(name: .sort) + " Sort"
header.FilterButton?.font = UIFont.fontAwesome(ofSize: 18)
header.FilterButton?.text = String.fontAwesomeIcon(name: .filter) + " Filter"
return header
}
func tableView(_ tableView: UITableView, editActionsForRowAt: IndexPath) -> [UITableViewRowAction]? {
let more = UITableViewRowAction(style: .normal, title: "More") { action, index in
print("more button tapped")
}
more.backgroundColor = .lightGray
let favorite = UITableViewRowAction(style: .normal, title: "Favorite") { action, index in
print("favorite button tapped")
}
favorite.backgroundColor = .orange
let share = UITableViewRowAction(style: .normal, title: "Share") { action, index in
print("share button tapped")
}
share.backgroundColor = .blue
return [share, favorite, more]
}
func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
return true
}
func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
searchBar.endEditing(true)
let translation = scrollView.panGestureRecognizer.translation(in: scrollView.superview)
if(translation.y > 0)
{
// react to dragging down
} else
{
// react to dragging up
}
}
может помочь мне решить эту проблему взмахом.
и еще одна вещь, я могу скрыть вид заголовка на прокрутке.