我在ios应用程序中有四个选项卡。我想从视图加载中显示图像预览。我该如何解决?
答案 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
});
}