我想使用一个非常大的分段控制组件,所以我想在 uiscrollview 中制作它。所以通过水平滚动用户可以选择适当的项目。我写了这段代码:
CGRect rect = [[UIScreen mainScreen] applicationFrame];
CGRect frame = CGRectMake(rect.origin.x + kLeftMargin, rect.size.height - kPaletteHeight - kTopMargin, 2*rect.size.width , kPaletteHeight);
seg.frame = frame;
scroll.frame = frame;
scroll.contentSize = CGSizeMake(frame.size.width * 2,frame.size.height);
scroll.showsHorizontalScrollIndicator = YES;
scroll.showsVerticalScrollIndicator = NO;
scroll.scrollsToTop = NO;
[scroll addSubview:seg];
但是滚动视图并没有让segmentedcontrol被看到。我的错误在哪里?