我正在尝试将标签添加到操作表中的选择器视图。
如果选择器视图不在操作表中,则代码正在工作。
我的代码:
- (void)initActionSheetPickerView {
actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];
pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 40, 0, 0)];
pickerView.showsSelectionIndicator = YES;
pickerView.dataSource = self;
pickerView.delegate = self;
pickerViewMeasureLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 97, 50, 22)];
pickerViewMeasureLabel.text = @"asdf";
pickerViewMeasureLabel.font = [UIFont boldSystemFontOfSize:20];
pickerViewMeasureLabel.textColor = [UIColor blackColor];
pickerViewMeasureLabel.backgroundColor = [UIColor clearColor];
pickerViewMeasureLabel.shadowColor = [UIColor whiteColor];
pickerViewMeasureLabel.shadowOffset = CGSizeMake (0, 1);
[pickerView addSubview:pickerViewMeasureLabel];
UISegmentedControl *closeButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@"Done"]];
closeButton.momentary = YES;
closeButton.frame = CGRectMake(260, 7, 50, 30);
closeButton.segmentedControlStyle = UISegmentedControlStyleBar;
closeButton.tintColor = [UIColor blackColor];
[closeButton addTarget:self action:@selector(dismissActionSheet:) forControlEvents:UIControlEventValueChanged];
[actionSheet addSubview:pickerView];
[actionSheet addSubview:closeButton];
}