我想为一个节日制作一个阵容。您可以在下面看到我想要实现的目标。
您可以在各个方向滚动,水平 - 垂直和从左到右角(不知道英文中的正确单词)。如果您在一个部分滚动,则其他部分应该随之滚动。
我的问题是知道你怎么能做到这一点?我正在寻找几天来让这个工作,但没有找到一个好的解决方案......
我想为一个节日制作一个阵容。您可以在下面看到我想要实现的目标。
您可以在各个方向滚动,水平 - 垂直和从左到右角(不知道英文中的正确单词)。如果您在一个部分滚动,则其他部分应该随之滚动。
我的问题是知道你怎么能做到这一点?我正在寻找几天来让这个工作,但没有找到一个好的解决方案......
UITableView 中的行不会在 UITableView 内滚动。一种解决方案是使用 UIScrollView,然后在里面添加 UITableView。此 UIScrollView 将具有与您的 UITableView 现在相同的大小,但 UIScrollView contentSize 属性将具有相同的高度但它会具有更大的宽度。
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's 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;