UIButton in a UITableView header ignores most touches

前端 未结 9 2570
盖世英雄少女心
盖世英雄少女心 2020-12-28 18:58

I\'ve got a button that I\'m adding as a subview of a table view\'s tableHeaderView. The button appears fine, and tap-and-holding on it works intermittently - for the most p

9条回答
  •  清酒与你
    2020-12-28 19:16

    I have the same problem UIButtons actions not working in UITableView's header view. First i tried setAutoresizingMask to .None which not works then after reading the answers of @Davyd and @Alexey i realise that i did not set the height of headers view then i set it like:-

    self.tablevwMain.tableHeaderView?.frame = CGRect(x: 0, y: 0, width: width_view, height: your_height)
    

    And all UIButton'sinside UITableView's header view works correctly.

提交回复
热议问题