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)

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:

enter image description here

unclickable:

enter image description here

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.

  1. give fix height uiview
  2. take outlet of height constraint of uiview
  3. now, in viewdidlayoutsubviews change constraint of uiview uitableview contentsize height.

    self.heightconstraint = self.tableview.contentsize.height

let me know, if helps!


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -