twitter-archive / twui

A UI framework for Mac based on Core Animation
Other
2.74k stars 268 forks source link

TUIButton in tableview header. Popup Menu not showing #90

Closed erndev closed 12 years ago

erndev commented 12 years ago

I am using a a TUITableView, with one header and several cells. The header view has a TuiButton with a menu. First time the table view is loaded, the button displays the menu.

But i found a problem whenever i reload the data. If i reload the data, the button won't display the menu any more. Debugging, i can see that the mousedown is catched, and that the call to the popUpMenuPositioningItem function is done. But no menu is shown. If just after that i resize the window, even a little bit, and then i click again in the button, the menu shows just fine.

I've done another test displaying a popup menu when mousedown is detected in the header view of the table, and the same happens. I need to resize the window after "reloadData" in order to be able to show the popup menu.

erndev commented 12 years ago

Well, problem solved. If someone else faces this problem, what was happening is that i was changing the button menu (which is in the table view header) after calling reloadData. If i set the menu in the datasource methods when the header view is requested, everything seems fine.