저는 사용자 정의 UIPickerView가 UIActions 시트에 임베드되어 있는데, UIActions 시트는 호출 될 때 화면 절반이 나옵니다. 훌륭하게 작동합니다. 문제는 모든 데이터가로드 된 후 barrelPicker가 처음으로 나타날 때 선택 항목으로 '가장 가능성있는'결과를 표시하도록하려는 것입니다.
사용자 지정 선택기가 작업 시트에 포함되기 전에 UIViewController에서 가져 왔고 ViewController의 viewDidLoad 메서드에서 "showProbableResults"(사용자 지정 메서드)를 호출하고있었습니다. 그 시점에서 UIPickerView가로드되어 준비가되었습니다. 현재이 방법을 호출 할 수있는 동일한 위치가 있습니까? 아니면 전체 디자인을 재고 할 필요가 있습니까? 본질적으로 필요한 것은 UIPickerView가로드 된 후에 이것을 호출하는 곳입니다.UIPickerController - 로딩시 특정 선택을 표시하고 싶습니다.
- (void)startWithDelegate:(UIViewController <ImageProcessingDelegate> *)sender
{
self.delegate = sender;
self.showFirstBottle = YES;
[self start];
}
- (void) start {
self.actionSheet = [[UIActionSheet alloc] initWithTitle:@"Choose Something"
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
[self.actionSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent];
CGRect pickerFrame = CGRectMake(0, 40, 0, 0);
NSLog(@"1.) About to alloc the picker");
self.vintagePicker = [[UIPickerView alloc] initWithFrame:pickerFrame];
self.vintagePicker.showsSelectionIndicator = YES;
self.vintagePicker.dataSource = self;
self.vintagePicker.delegate = self;
[self.actionSheet addSubview:self.vintagePicker];
[self.vintagePicker release];
UISegmentedControl *nextButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@"Next"]];
nextButton.momentary = YES;
nextButton.frame = CGRectMake(260, 7.0f, 50.0f, 30.0f);
nextButton.segmentedControlStyle = UISegmentedControlStyleBar;
nextButton.tintColor = [UIColor blackColor];
[nextButton addTarget:self action:@selector(show:) forControlEvents:UIControlEventValueChanged];
[self.actionSheet addSubview:nextButton];
[nextButton release];
UISegmentedControl *backButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@"Back"]];
backButton.momentary = YES;
backButton.frame = CGRectMake(10, 7.0f, 50.0f, 30.0f);
backButton.segmentedControlStyle = UISegmentedControlStyleBar;
backButton.tintColor = [UIColor blackColor];
[backButton addTarget:self action:@selector(cancel:) forControlEvents:UIControlEventValueChanged];
[self.actionSheet addSubview:backButton];
[backButton release];
[self.actionSheet showInView:_delegate.parentViewController.tabBarController.view]; // show from our table view (pops up in the middle of the table)
[self.actionSheet setBounds:CGRectMake(0, 0, 320, 485)];
}
작업 시트/선택 도구가 사용자 정의 클래스입니까? 코드를주세요. – AMayes
예 액션 시트와 피커는 NSObject의 커스텀 클래스입니다. 위의 코드는 무엇입니까? –