分段控件无法在垂直方向重新定位位置。它显示在图像中。任何人都可以帮我定位分段控件。
int offset = BAR_OFFSET + 40 * bars.count;
for (int i = bars.count; i < guessRows; i++)
{
UISegmentedControl *bar = [[UISegmentedControl alloc] initWithItems:
[NSArray arrayWithObjects:@"", @"", @"", nil]];
bar.segmentedControlStyle = UISegmentedControlStyleBar;
bar.transform = CGAffineTransformMakeRotation(M_PI_2);
bar.momentary = YES;
[bar addTarget:self action:@selector(submitGuess:)
forControlEvents:UIControlEventValueChanged];
CGRect frame = bar.frame;
frame.origin.y = offset; // position it below the last bar
frame.origin.x = 20; // give it some padding on the left
[self.view addSubview:bar]; // add the bar to the main view
[bars addObject:bar];
[bar release];
}