在“presentViewController”之间加载UIVIew的好方法是什么?

时间:2013-11-08 03:05:03

标签: ios iphone objective-c uiview uiviewcontroller

我正在使用presentViewController(现在)从一个UIViewController到另一个UIViewController,但是当我触摸按钮以到达下一个UIViewController时,第一次呈现时会出现第二次“滞后”。

任何人都知道一种简单的方法可以像“加载屏幕”一样运行X段时间,然后会出现所需的ViewController?这种方式实际上并不会发生延迟,因为它会被“加载屏幕”所掩盖

先谢谢!!

1 个答案:

答案 0 :(得分:0)

在第一堂课中写下这段代码,例如: -

- (IBAction) clickButton:(UIButton *) sender 
    {
        [self performSelector:@selector(presentAnotherView) withObject:nil afterDelay:1.0f];
    }

    - (void) presentAnotherView
    {
        HomeViewController *home = [[HomeViewController alloc] initWithNibName:@"HomeViewController" bundle:nil];

        [self presentModalViewController:home animated:YES];
    }