2013-03-05 46 views
0

我想在我的應用程序右側有一個按鈕。當它被挖掘出來時,它必須在主視圖上從右側拉出一個視圖,並且它只應該是主視圖的三分之一大小。是否有任何控制權已經寫入並公開使用?從左側開始爲ipad廣告支持

+0

所需的幾個細節:1。你想要動畫子視圖嗎? 2.你的意思是像Facebook應用程序? – 2013-03-05 09:29:33

+0

是的,就像臉書上的內容 – Manoj 2013-03-05 09:44:01

+0

看到我的答案,你很清楚的想法,它應該添加一些代碼作爲你自己的代碼,以達到你的目的地,並請接受,如果它幫助你 – 2013-03-05 09:56:59

回答

2

如果您嘗試在默認的Facebook應用中執行類似操作,則可以按照此方法進行操作。

首先添加新UIView作爲一個子視圖 和

-(void)viewDidAppear:(BOOL)animated 
    { 
     CGRect customeFrame = CGRectMake(// set the frame parameters to keep the view out of visible region) 
     [newView setFrame:customeFrame]; 
    } 

然後在您的按鈕操作,您可以使用UIView動畫帶來的視圖可見區域 一樣,

- (void)clickedButton 
     { 
     [UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationCurveEaseInOut animations:^{ 
         //set the frame of newView to visible region 
     CGRect customeFrame = CGRectMake(// set the frame parameters to keep the view in the visible region) 
     [newView setFrame:customeFrame]; 
      } completion:^{ 
    //add what you need to do on completion 
    }]; 
} 

注:我還沒有設置幀的可見和隱藏狀態的newView,因爲我需要它由y設置根據你的要求自己。除了newView.frame.origin.y屬性外,所有內容都是相同的。

希望這是有道理的。

+0

這是我真正想到的但我正在尋找乾淨的控制。但回到你提到的舊觀念。謝謝你的幫助。 – Manoj 2013-03-06 06:41:18

0

你可能想使用JTRevealSidebar:download here

它左側的按鈕雖然。