问题
I have a custom header which is sub class of UITableViewHeaderFooterView
I want to add the delete button similar to UITableViewCell
to this header,
I have gone through the internet and found some open source libraries to create swipeable cell which only extend the functionality of UITableviewCell
which actually I don't need for the time,
What I actually want is to create a swipeable header View to show the delete button on swipe.
回答1:
There is not out of the box solution for this. However we can still do it by our own custom delete button. The idea is to have a UIButton
under the header content view and animate it when swiping on header.
Ray Wenderlichs has a great tutorial for How To Make A Swipeable Table View Cell With Actions
Use the same logic for UITableViewHeaderFooterView
and you are good to go.
来源:https://stackoverflow.com/questions/36301970/how-to-make-swipeable-uitableview-header-to-show-delete-button-like-cells