2014-01-25 44 views
2

我想要設計我的界面,如下所示:在屏幕頂部用戶可以看到圖片(圖片視圖),底部可能是帶有按鈕(或其他控件元件)。當屏幕加載首先我想顯示一個圖像和60%的視圖,其中包含按鈕,然後,用戶拉動底部查看與手勢,因此它隱藏圖像視圖,揭示視圖全尺寸。然後用戶可以用手指拉底將其再次隱藏至「真」尺寸的60%。通過手勢拉動視圖來隱藏部分

在這裏,我試圖發佈一個屏幕,可以在視覺上解釋它(因爲我怕你可能不知道我想要什麼)。

我想知道如何實現它,任何意見將不勝感激,謝謝。如下圖所示

enter image description here

+1

我想你想模仿類似Facebook的iOS應用程序的圖片瀏覽器?用戶能夠拉起文本來查看它? 您是否希望用戶能夠平移底部視圖(用手指向上/向下移動它),還是希望用戶能夠點擊它以顯示完整視圖並重新點擊以隱藏它? – n00bProgrammer

+0

只需用手指將其拉起來,然後當用戶到達屏幕頂部時,它會固定在它上面,然後他可以下拉到第一個狀態 –

回答

3

添加滑動手勢你仰視圖。

UISwipeGestureRecognizer *ges =[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipe:)]; 
[bottomView addGestureRecognizer:ges]; 

- 刷卡處理器 -

-(void)swipe:(UISwipeGestureRecognizer *)swipeGes{ 
    if(swipeGes.direction == UISwipeGestureRecognizerDirectionUp){ 
     [UIView animateWithDuration:.5 animations:^{ 
      //set frame of bottom view to top of screen (show 100%) 
      bottomView.frame =CGRectMake(0, 0, 320, bottomView.frame.size.height); 
     }]; 
    } 
    else if (swipeGes.direction == UISwipeGestureRecognizerDirectionDown){ 
     [UIView animateWithDuration:.5 animations:^{ 
      //set frame of bottom view to bottom of screen (show 60%) 
      bottomView.frame =CGRectMake(0, 300, 320, bottomView.frame.size.height); 
     }]; 
    } 
} 
+0

謝謝,你爲我節省了很多時間:) –