我有以下代码来绘制一个日期选择器(显示在屏幕中间)。它适用于iOS 7,但在iOS 8中却没有显示。只有"选择到期日"显示在屏幕底部的一个小方框中。
menu = [[UIActionSheet alloc] initWithTitle:@"Select Expiry Date"
delegate:nil
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
pickerView = [[CDatePickerViewEx alloc] init];
CGRect pickerRect = pickerView.bounds;
pickerRect.origin.y = 50;
pickerRect.size.height = 100;
pickerView.frame = pickerRect;
UIButton *startbtn = [UIButton buttonWithType:UIButtonTypeCustom];
startbtn.frame = CGRectMake(240,12, 60, 25);
[startbtn setTitle:@"OK" forState:UIControlStateNormal];
[startbtn setBackgroundImage:[UIImage imageNamed:@"btn"] forState:UIControlStateNormal];
[startbtn addTarget:self action:@selector(pressedbuttonCancel:) forControlEvents:UIControlEventTouchUpInside];
[menu addSubview:pickerView];
[menu addSubview:startbtn];
[menu showInView:self];
[menu setFrame:CGRectMake(0,200,320, 260)];
答案 0 :(得分:0)
检查您的视图是否启用了AutoLayout,以及大小类。我之前遇到过类似的问题,并且记得用程序化约束修复它。