ios - UITableView inside UIScrollView - Cell not clickable -
i have problem uitableview not detecting touches.
in iphone-only app, have uiviewcontroller, containts:
- uiscrollview
- uiview (let's content view)
- some labels
- uitableview (last)
- uiview (let's content view)
the labels have dynamic height, because contain text must retrive web, i'm using auto layout. i'm setting content size of uiscrollview inside viewdidlayoutsubviews method, , i'm doing summing uitableview.frame.origin.y , height.
here comes problem: when labels contain words , uitableview not exceed iphone screen size, works ok. when grow, , uitableview gets pushed down, when scroll down can't click on cell anymore. also, if when loading view table half visible , half not, can click visible cells, if scroll down, can't click others.
i'm using swift 2 , xcode 7.
here example:
clickable:
unclickable:
do following thing:
yourview.cliptobounds = true now, if uitableview not appears means uiview not same bigger hold down uitableview.
make sure uiview height bigger hold contents in , try tap on it.
updated:
if using autolayout, following thing.
- give fix height
uiview - take outlet of height constraint of
uiview now, in
viewdidlayoutsubviewschange constraint ofuiviewuitableviewcontentsizeheight.self.heightconstraint = self.tableview.contentsize.height
let me know, if helps!


Comments
Post a Comment