我的UISegmentedControl中有以下6个段
1)目标 2)概念 3)如何对待办事项 4)注意事项 5)模拟 6)CYU
当我启动我的应用程序时,我只能看到3个细分,而其他3个由于模拟器框架而仍然隐藏,我如何显示所有6个细分?如何切换其他细分?对于noob问题,我无法找到任何解决方案
答案 0 :(得分:2)
另一种选择是
UIScrollView *scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 60)];
scroll.showsHorizontalScrollIndicator = NO; //disable horizontal scroll
scroll.showsVerticalScrollIndicator = NO; //disable vertical scroll
NSArray *itemArray = [NSArray arrayWithObjects: @"Objective", @"Concept", @"How-to-Do",@"Note",@"Simulation",@"CYU", nil];
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:itemArray]; //provide array of segment names
segmentedControl.frame = CGRectMake(0, 0, 600, 50);//change accordingly
segmentedControl.segmentedControlStyle = UISegmentedControlStylePlain;
segmentedControl.selectedSegmentIndex = 1; //by default selected index
[scroll addSubview:segmentedControl]; // add segment
scroll.contentSize = CGSizeMake(segmentedControl.frame.size.width, segmentedControl.frame.size.height+10); //change accordingly
[segmentedControl release];
[self.view addSubview:scroll]; //add scroll view