使上時所期望的按鈕被按下取消隱藏view.Then隱藏它具有它的大小爲u desired.and隱藏在視圖DidLoad.and該視圖與選擇器視圖一個UIView畢竟你needs.it的這樣simple.otherwise調整Pickerview的大小desired.`
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];
添加選擇器這樣的。 `
謝謝 - 但這不會灰掉底層屏幕,並且底層屏幕元素的所有其他元素仍然可以訪問... – user387184 2012-07-25 09:30:48
做一件事...做一個灰色圖像背景全尺寸視圖。並有透明的部分,你將添加拾取器和所有其他的東西,然後添加選擇器視圖和所有的buutons該視圖。並做我喜歡我所說的。因此,backgrnd會變灰。如果需要我會給你的代碼做一個透明的看法... – hacker 2012-07-25 09:36:16
看到editted答案..就像你需要添加所有controlls。 – hacker 2012-07-25 09:42:56