我正在尝试将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的大小以调整子视图?
答案 0 :(得分:1)
订单非常重要。您需要首先在UIActionsheet上调用showInView:然后调整其大小。这是另一个解决这个问题的问题: