iphone - UIScrollView in IOS -
i have gridview using, has header, side bar , gridview inside, have setup scrolling it's not working way want it.
i'm trying make scrolling when scroll horizontally left side bar stay while grid scrolls when scroll vertically want move grid. , wanted header @ top same, vertically scrolling make stay , horizontally scroll make move grid.
i have done scroll view moves , doesn't work right.
so can please me, thanks.
the best way so, move inside views of scollview in opposite direction of scrollview example have uiview called "bar" in scrollview, need detect every time scollview scolls delegate , move "bar" it:
- (void)scrollviewdidscroll:(uiscrollview *)scrollview { // move horizontal if (self.lastcontentoffsetx != scrollview.contentoffset.x) { [bar setframe:cgrectmake(scrollview.contentoffset.x,bar.frame.origin.y, bar.frame.size.width, bar.frame.size.height)]; } // move vertical if (self.lastcontentoffsety != scrollview.contentoffset.y) { //move control want steady } self.lastcontentoffsetx = scrollview.contentoffset.x; self.lastcontentoffsety = scrollview.contentoffset.y;
}