UIDatePicker
ユニバーサルアプリで表示しています。iPhoneでは問題なく表示されますが、iPadでは下部のみが表示されます。私はUIActionSheet
両方でうまく表示されるアプリの他の部分で使用しています。iPadで正しく表示するにはどうすればよいですか?
- (void)showDatePicker
{
actionSheet = [[UIActionSheet alloc] initWithTitle:nil
delegate:nil
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
[actionSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent];
datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 40, 0, 0)];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
NSString *startTimeString = [MathFunctions minutesToTimeString:[appointment.start_time integerValue]];
[dateFormatter setDateFormat:@"yyyyMMdd h:mm a"];
[dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]];
NSString *dateTimeString = [NSString stringWithFormat:@"%@ %@", appointment.date, startTimeString];
datePicker.date = [dateFormatter dateFromString:dateTimeString];
[actionSheet addSubview:datePicker];
UISegmentedControl *closeButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@"Done"]];
closeButton.momentary = YES;
closeButton.frame = CGRectMake(260, 7.0f, 50.0f, 30.0f);
closeButton.segmentedControlStyle = UISegmentedControlStyleBar;
closeButton.tintColor = [UIColor blackColor];
[closeButton addTarget:self action:@selector(changeDate:) forControlEvents:UIControlEventValueChanged];
[actionSheet addSubview:closeButton];
[actionSheet showInView:self.view];
[actionSheet setBounds:CGRectMake(0, 0, 320, 485)];
}