我正在尝试将 UISegmentController 添加到 UIActionSheet 这是我的代码
UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Copy", @"New Key", nil];
NSArray *keyLengthOptions = [NSArray arrayWithObjects:@"Option 1", @"Option 2", nil];
UISegmentedControl *segmentController = [[UISegmentedControl alloc]initWithItems:keyLengthOptions];
segmentController.frame = CGRectMake(35, 0, 250, 38);
[segmentController addTarget:self action:@selector(segmentValueChanged:) forControlEvents:UIControlEventValueChanged];
[segmentController setSegmentedControlStyle:UISegmentedControlStyleBar];
[actionSheet addSubview:segmentController];
[actionSheet setFrame:CGRectMake(0, 0, 320, 500)];
[actionSheet showInView:self.navigationController.tabBarController.view];
每件事都工作正常,但[actionSheet setFrame:CGRectMake(0, 0, 320, 500)];
不工作。如何增加 UIActionSheet 的大小以调整子视图?