5

フェスにラインナップしたい。ここで私が達成したいことを見ることができます。 ここに画像の説明を入力

あらゆる方向、水平 - 垂直、および左から右隅にスクロールできます (英語で適切な単語がわからない)。あるセクションでスクロールすると、他のセクションも一緒にスクロールする必要があります。

私の質問は、どうすればこれを達成できるか知っていますか? これを機能させるために何日も探していますが、良い解決策が見つかりません...

4

2 に答える 2

5

UITableView の行は、UITableView 内でスクロールしません。1 つの解決策は、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;
于 2013-05-08T09:26:56.237 に答える
1

UITableView のスクロールについて理解を深めるために、この 2 つのリンクをたどることができます。

テーブルの水平スクロール

テーブルの縦スクロール

UITableViewDelegateをよりよく理解し、慣れるために役立つことを願っています。ありがとう

于 2013-05-08T10:03:30.020 に答える