views:

256

answers:

1

Hi All,

I want to design a reports screen where there is a header row and one column both are fixed on there place. And there is a scrollable area in the empty space, which user can swipe which is filled of data.

I want to ask, can we design such view where if user swipes the scrollable view vertically, then column names should also scroll(top header will not move this time) and if user scrolls horizontally header row should adjust accordingly(left side column header will not move this time).

something like an xls sheet where there are 2 fixed headers on top as row and one on left side as column.

Thanks in advance.

Regards, Vishal

A: 

Yes, this is possible. You should set your view controller as a delegate of your UIScrollView, then implement scrollViewDidScroll: method, read scrollView.contentOffset and scroll your header rows/columns accordingly.

(BTW you do not want your header rows/columns to be the children of UIScrollView.)

Andrey Tarantsov
Hi Andrey. Thanks for your reply. I tried that and when i put a log in scrollViewDidScroll: method like NSLog(@"X point-> %f",scrollObj.frame.origin.x); NSLog(@"Y point-> %f",scrollObj.frame.origin.y); its returning me same vales as X-> 0 and Y-> 35.I have not set these values to scroller, still each finger swipe its returning me these values only. So i am not able to detect the Up/Down/Left/Right movement of finger which we can achieve in TouchedBegan, TouchesMoved methods.regards,Vishal.
Vishal Mali
That's right, scrollObj.frame.origin will never change. Please try scrollView.contentOffset instead.
Andrey Tarantsov