ios - UITableView Programmatically inside UIScrollView not calling delegate methods -


i trying load several uitableviews in uiscrollview using following code

int x = 0; (int = 0; < 14; i++) {          uitableview *testtableview = [[uitableview alloc] initwithframe:cgrectmake(x, 0, 150, scrollview.bounds.size.height)];         testtableview.datasource = self;         testtableview.delegate = self;         [testtableview settag:i];         [testtableview reloaddata];         [scrollview addsubview:testtableview];         x+=155;     }      [scrollview setcontentsize:cgsizemake(x, scrollview.bounds.size.height)]; 

the problem this, uitableview not responding of delegate methods.. ideas??

since tableview is (inherits from) scrollview, problem or scrollview delegate methods being called table views, parent scrollview.

if case, should perform check in delegate method. example

- (void)scrollviewdidscroll: (uiscrollview *)scrollview {     if ([scrollview isequal:tableview1]){      }else if ([scrollview isequal:tableview2]){      }else if ([scrollview isequal:parentscrollview]){      }  } 

edit:

to answer comment "how should make uitableview call uitabelview delegate methods not scrollview delegates methods"

it doesn't work that. when set testtableview.delegate = self; setting tableviews scrollview delegate. means, example, when tableview scrolls, appropriate scrollview delegate methods called. far know, way asking check in delegate methods

if ([scrollview isequal:parentscrollview]){    //do parentscrollview related things } 

this way, when delegate method called table views, nothing

see here more inheriting protocols.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -