2012-07-25 25 views
1

我有一對inputScreens,其中用戶按下一個按鈕,當前打開另一個pickerScreen with a picker and several buttons如何使一個新的屏幕不完全覆蓋iPhone上的底層屏幕

而不是顯示pickerScreen作爲一個完整的新屏幕完全覆蓋inputScreens的我想pickerScreen上的頂部顯示 -

像一個小屏幕中心和灰化,使交通不便 只要顯示pickerScreen,就會顯示相關的。

當前inputScreenspickerScreen是用UIViewController實現的。 ...和pickerScreen完全取代了。

是否有簡單的方法來更改pickerScreen,使其出現在inputScreens之上?

非常感謝

回答

4

使上時所期望的按鈕被按下取消隱藏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]; 

添加選擇器這樣的。 `

+0

謝謝 - 但這不會灰掉底層屏幕,並且底層屏幕元素的所有其他元素仍然可以訪問... – user387184 2012-07-25 09:30:48

+0

做一件事...做一個灰色圖像背景全尺寸視圖。並有透明的部分,你將添加拾取器和所有其他的東西,然後添加選擇器視圖和所有的buutons該視圖。並做我喜歡我所說的。因此,backgrnd會變灰。如果需要我會給你的代碼做一個透明的看法... – hacker 2012-07-25 09:36:16

+0

看到editted答案..就像你需要添加所有controlls。 – hacker 2012-07-25 09:42:56