2010-08-05 6 views
3

J'ai une application de tabbar. il y a un bouton dans l'un des onglets. Je veux ouvrir un nouveau uiviewcontroller par animation comme popup lorsque j'appuie sur le bouton. popupviewcontroller a uiwebview. Je veux montrer quelques pages Web en mode popup. J'ai conçu la popupview dans IB.comment ouvrir un nouveau uiview comme un popup?

comment puis-je ouvrir mon popupviewcontroller avec une animation comme FBConnect. FBconnect ouvre la vue de la boîte de dialogue de connexion avec animation comme une fenêtre contextuelle.

Répondre

8

Vous ne serez pas en mesure d'ouvrir comme un popup un UIViewController.

Pour cela, vous devrez utiliser un simple UIView

Ajouter la UIView (forme de pop-up comme) à la vue actuelle.

- (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

Eh oui, vous pouvez ouvrir ressembler fenêtre pop-up u utiliser simplement ce code et l'exécuter .. son ouverture très lentement dépend de votre temps donné ...

pourrait être utile

(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);}]; 
} 
Questions connexes