多くのボタン(例:20個のボタン)を持つスクロールメニューのように、上部に水平スクロールビューを作成するにはどうすればよいですか? 助けてください!n個のボタンを持つ水平スクロールビュー:[iOS]
私は、次のコードを使用しています:
CGRect buttonFrame = CGRectMake(0.0f, 0.0f, scrollView.frame.size.width, scrollView.frame.size.height);
for (NSString *text in wordsArray) {
UIButton *button = [[UIButton alloc]initWithFrame:buttonFrame];
button.text = text;
[scrollView addSubview:button];
buttonFrame.origin.x +=buttonFrame.size.width;
}
CGSize contentSize = scrollView.frame.size;
contentSize.width = buttonFrame.origin.x;
scrollView.contentSize = contentSize;
をしかし、私が望むものを得ていません。
あなたがhttp://stackoverflow.com/questions/6688160/how-to-programmatically-add-a探しているもののために、私はこれは一つだと思い、この答えを確認してください-uisegmentedcontrol-to-a-container-view/6689592#6689592 – Wolverine