切换视图(查看控制器)

时间:2014-07-07 20:43:01

标签: ios uiviewcontroller

我使用IBAction来切换视图而不首先解除根目录。这两个代码都能正常工作,但我想知道它们之间的区别和最佳选择(可能用于内存控制)!区别在于第二行...... [self ...]

-(IBAction)switchpage13:(id)sender
{
    UIViewController *parentViewController = self.presentingViewController;
    [self dismissViewControllerAnimated:NO completion:^
     {
    BalladViewController *ballad = [[BalladViewController alloc]
                                      initWithNibName:@"BalladViewController_iPad" bundle:nil];

         [parentViewController presentViewController:ballad  animated:NO completion:nil];
         [ballad release];
     }];
}

OR

-(IBAction)switchpage14:(id)sender{
    UIViewController *parentViewController = self.presentingViewController;
    [self.presentingViewController dismissViewControllerAnimated:NO completion:^
     {
         PopViewController *pop = [[PopViewController alloc]
                                           initWithNibName:@"PopViewController_iPad" bundle:nil];

         [parentViewController presentViewController:pop  animated:NO completion:nil];
         [pop release];
     }];
}

0 个答案:

没有答案