我有几个inputScreens
,其中用户按下一个按钮,该按钮当前打开另一个pickerScreen with a picker and several buttons
。
而不是将pickerScreen
显示为完全覆盖inputScreens
的完整新屏幕,我希望pickerScreen
显示在inputScreen
-
像一个较小的屏幕居中,灰白,无法访问 只要显示inputScreen
,就可以使用基础pickerScreen
。
目前使用UIViewController实现inputScreens
和pickerScreen
。 ...... pickerScreen
完全取代了inputScreen
。
是否有一种简单的方法可以更改pickerScreen,使其显示在inputScreens的顶部?
非常感谢
答案 0 :(得分:4)
使用其所需大小的选择器视图制作UIView。并在视图中隐藏该视图DidLoad.and当按下所需按钮时取消隐藏该视图。然后在所有需求之后隐藏它。这很简单。根据需要调整Pickerview的大小。
UIView *whiteCoverView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 400)];
whiteCoverView.alpha = 0.9;
whiteCoverView.tag = 999;
whiteCoverView.backgroundColor = [UIColor grayColor];
[self.view addSubview:whiteCoverView];
UILabel *label2 = [[UILabel alloc] initWithFrame:CGRectMake(0, 25, 320, 40)];
label2.backgroundColor = [UIColor clearColor];
label2.numberOfLines = 0;
label2.font = [UIFont boldSystemFontOfSize:15.0];
label2.shadowColor = [UIColor colorWithWhite:0.0 alpha:0.5];
label2.textAlignment = UITextAlignmentCenter;
label2.textColor = [UIColor whiteColor];
label2.text = @"cfff";
[whiteCoverView addSubview:label2];
[label2 release];
int gap = 10;
UILabel *label3a = [[UILabel alloc] initWithFrame:CGRectMake(20, gap+50, 280, 15)];
label3a.backgroundColor = [UIColor clearColor];
label3a.numberOfLines = 0;
label3a.font = [UIFont boldSystemFontOfSize:13.0];
label3a.shadowColor = [UIColor colorWithWhite:0.0 alpha:0.5];
label3a.textAlignment = UITextAlignmentCenter;
label3a.textColor = [UIColor whiteColor];
label3a.text = @"cfccc ";
[whiteCoverView addSubview:label3a];
[label3a release];
像这样添加选择器。 `