在页面加载之前显示图像

时间:2014-04-12 14:14:28

标签: ios timer uiimageview

我在ios应用程序中有四个选项卡。我想从视图加载中显示图像预览。我该如何解决?

1 个答案:

答案 0 :(得分:0)

-viewWillAppear:中,显示您的图片。然后使用dispatch_after中的-viewDidAppear:块来延迟设置其余用户界面。

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.imageView.image = [UIImage imageNamed:@"myImageName"];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(myDelayInSeconds * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        // Code to animate removal the image view,
        // adding new views, or whatever else you need to do here
    });
}