Horizontal and vertical scrolling in UITableview

I want to make a list for the festival. You can see what I want to achieve below. enter image description here

You can scroll in any direction, horizontally - vertically and from left to right (do not know the correct word in English). If you scroll in one section, then any other section should scroll along with it.

My question is - do you know how you can achieve this? I am looking for days to get this job, but not find a good solution ...

+4
source share
2 answers

A string in a UITableView does not scroll inside a UITableView. one solution is to use a UIScrollView and then add a UITableView inside. This UIScrollView will be the same size as your UITableView, but the UIScrollView contentSize property will be the same height, but it will be wider.

enter image description here

UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(x, x, x, x) style:...] [scrollView addSubview:tableView]; // Set the size of your table to be the size of it contents // (since the outer scroll view will handle the scrolling). CGRect tableFrame = tableView.frame; tableFrame.size.height = tableView.contentSize.height; tableFrame.size.width = tableView.contentSize.width; // if you would allow horiz scrolling tableView.frame = tableFrame; // Set the content size of your scroll view to be the content size of your // table view + whatever else you have in the scroll view. // For the purposes of this example, I'm assuming the table view is in there alone. scrollView.contentSize = tableView.contentSize; 
+4
source

For a better understanding by scrolling UITableView you can follow these two links

horizontal scrolling table

vertical scroll table

Hope this helps you better understand and get to know the UITableViewDelegate. Thanks

+1
source

Source: https://habr.com/ru/post/1479693/


All Articles