ios - UIButton in UITableView tableHeaderView not responding to touches -
ok feel idiot can't working, , none of other answers on getting me anywhere.
i have simple uiview
have defined in .xib , loading tableheaderview
of uitableviewcontroller
:
uiview* headerview = [[nsbundle mainbundle] loadnibnamed:@"profileheaderview" owner:self options:nil][0]; self.tableview.tableheaderview = headerview;
the file's owner of header .xib set controller class, , far works fine. outlets connecting , can set labels correct values, etc.
but, when added uibutton
headerview, not responding touches no matter try.
i've confirmed frames of header , of button correct , both have userinteractionenabled
yes
.
i cannot life of me figure out why isn't working. not doing tricky here can think of.
here's debug info:
po self.tableview.tableheaderview <uiview: 0x17ef5420; frame = (0 0; 320 194); autoresize = w+h; layer = <calayer: 0x17eda4a0>> po self.loginbutton <uibutton: 0x17ec1630; frame = (80 164; 160 30); opaque = no; autoresize = rm+bm; layer = <calayer: 0x17eec760>>
update: discovered new evidence. above logged inside viewdidload
, , frames have correct values. however, if set breakpoint in tableview:didselectrowatindexpath:
, notice somehow header view frame height has changed 130 px!
po self.profileheaderview <uiview: 0x15eb6790; frame = (0 0; 320 130); autoresize = w+h; layer = <calayer: 0x15eb67f0>>
i don't know causing this! of course know this, if explicitly set frame's height 194 in viewdidappear:
works fine. fix whatever changing frame in first place.
the header still draws properly, , correct height (194 px) when rendered, reason frame getting changed @ point, causing button fall outside of frame , not receive touches.
what changing header's frame this? don't have constraints set on @ all.
try using ,
[button sendactionsforcontrolevents:uicontroleventtouchupinside];
if calls target / selector problem view hierarchy. if not problem haven't coded target / selector button.
Comments
Post a Comment