我正在尝试将一个带有UIButton的UIDatePicker显示在UIActionSheet中。不幸的是,它被裁剪了,整个日期选择器都不可见。我甚至还没有尝试添加UIButton。有人能建议如何使整个视图适合?我不知道如何添加正确的尺寸,因为UIActionSheet似乎缺少-initWithFrame:
类型的构造函数。
UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@"Date Picker"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:nil];
// Add the picker
UIDatePicker *pickerView = [[UIDatePicker alloc] init];
pickerView.datePickerMode = UIDatePickerModeDate;
[menu addSubview:pickerView];
[menu showInView:self.view];
[pickerView release];
[menu release];
我也试过类似的东西:
UIActionSheet *menu = [[UIActionSheet alloc] initWithFrame:CGRectMake(200.0, 200.0, 100.0f, 100.0f)];
坐标当然不是实际的,但似乎不影响UIActionSheet的位置/大小。