UIPickerView
으로 iPad에 UIActionSheet
을 표시하려하고 있습니다. 따라서 UIPickerView
위임자와 데이터 소스가 작동하지만 iPad에서는 -[UIActionSheet showFromRect:inView:animated:]
을 사용할 때와 동일한 코드가 iPhone에서 작동합니다. 결과는 UIPopover
/UIActionSheet
너무 작기 때문에 프레임 크기를 설정할 수 없으며 단추도 표시되지 않습니다.iPad 프레임의 UIActionSheet가 너무 작음
경계 외부에 있거나 다른 상황이 발생했기 때문에 이것이 가능한지 나는 알 수 없습니다. 이것은 필수가 아닌 코드 (iPhone 등)를 모두 제거한 후 내 코드가 어떻게 생겼는지를 보여줍니다. 아무도 내가 뭘 잘못하고 있는지 아는 사람이 있습니까?
CGRect thePickerFrame = CGRectMake(0, 0, 320.0, 485.0);
UIPickerView * thePickerView = [[UIPickerView alloc] initWithFrame:thePickerFrame];
[pickerActionSheet release], pickerActionSheet =
[[UIActionSheet alloc] initWithTitle:@"Choose" delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Next", nil];
thePickerView.showsSelectionIndicator = YES;
thePickerView.dataSource = self;
thePickerView.delegate = self;
[pickerActionSheet addSubview:thePickerView];
[thePickerView selectRow:0 inComponent:0 animated:NO];
[thePickerView release];
[pickerActionSheet showFromRect:currentTextField.bounds
inView:currentTextField animated:NO];
pickerActionSheet.frame = thePickerFrame;
[UIActionSheet setFrame :]이 호출되는 것을 확인하기 위해 조금 실험했습니다. 위의 이벤트 루프를 iOS 결과에 의해 시작된 다른 이벤트 루프라고합니다 - [UIActionSheet setFrame :] 표시된 작은 프레임을 호출 한 것 같습니다. –
이 기능을 사용하는 iPad의 팝업으로 더 좋지 않습니까? AFAIK ActionSheet는 단추 전용입니다. – Eimantas