gpt4 book ai didi

ios - 无法将 UIDatePicker 添加到 UIActionSheet

转载 作者:行者123 更新时间:2023-11-28 17:42:21 25 4
gpt4 key购买 nike

我想添加一个UIDatePicker到一个UIActionSheet,代码如下:

UIActionSheet* actionSheet = [[UIActionSheet alloc] initWithTitle:@"DEMO" delegate:self cancelButtonTitle:@"Cancle" destructiveButtonTitle:nil otherButtonTitles:nil];


actionSheet = [[UIActionSheet alloc] initWithTitle:@"Ratings"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:nil];

UIDatePicker *pickerView = [[UIDatePicker alloc] init];
pickerView.datePickerMode = UIDatePickerModeDate;

[actionSheet addSubview:pickerView];
[actionSheet showInView:self.view];
[actionSheet sendSubviewToBack:pickerView];

[actionSheet showInView:self.view];
[actionSheet setBounds:CGRectMake(0,0,320, 500)];

CGRect pickerRect = pickerView.bounds;
pickerRect.origin.y = -100;
pickerView.bounds = pickerRect;

[pickerView release];
[actionSheet release];

问题是为什么这段代码在iphone模式下可以,而在ipad模式下却不能工作

最佳答案

我会尝试使用 EAActionSheetPicker .它会为您处理。

关于ios - 无法将 UIDatePicker 添加到 UIActionSheet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7642654/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com