2010-08-05 28 views
3

我有一個tabbar應用程序。在其中一個選項卡中有一個按鈕。 我想打開一個新的uiviewcontroller通過動畫像彈出當我按下按鈕。 popupviewcontroller有一個uiwebview。我想在彈出視圖中顯示一些網頁。 我設計了IB中的popupview。如何打開一個新的uiview就像一個彈出?

我怎麼能打開我的popupviewcontroller與動畫像FBConnect。 FBconnect使用彈出式等動畫打開登錄對話框視圖。

回答

8

你將不能像彈出的UIViewController一樣打開。

對於您將不得不使用一個簡單的UIView

UIView的(彈出形狀等)添加到您的當前視圖。

- (void) initPopUpView { 
    popup.alpha = 0; 
    popup.frame = CGRectMake (160, 240, 0, 0); 
    [self.view addSubview:popup]; 
} 

- (void) animatePopUpShow { 
    [UIView beginAnimations:nil context:NULL]; 
    [UIView setAnimationDuration:0.3]; 
    [UIView setAnimationDelegate:self]; 
    [UIView setAnimationWillStartSelector:@selector(initPopUpView)]; 

    popup.alpha = 1; 
    popup.frame = CGRectMake (20, 40, 300, 400); 

    [UIView commitAnimations]; 
} 
4

是的,你可以打開的樣子彈出的窗口中你剛剛使用此代碼並運行它.. 其打開很慢取決於你給定的時間...

可能會有所幫助

(void)popup 
{ 
    UIView *AView1=[[UIView alloc] initWithFrame:CGRectMake(self.view.frame.size.width/2,self.view.frame.size.height/2, 0, 0)]; 
    [AView1 setBackgroundColor:[UIColor redColor]]; 
    [UIView animateWithDuration:2.5 animations:^{AView1.frame = CGRectMake(35, 10, self.view.frame.size.width-70, self.view.frame.size.height-100);}]; 
} 
相關問題