简体   繁体   中英

How to add an UIView as a subview to Storyboard's view without any delay?

I'm not for sure if my title responds what I want to ask but let me explain;

I'm using storyboard, I have created "HomeViewController" and set it as custom class. Also, I want to create a view with programmatically and add this view to "HomeViewController" 's view.

在此处输入图片说明

These TabBar, GreenView and Logout Button are necessary. Because I added them via interface builder to see how quickly they appear on the screen and whenever I build and run my app, these components are load very quickly. They are not blinking or appear after a sec. They are stable!

Here is a simple code;

- (void)viewDidLoad {
[super viewDidLoad];

UIView *dummyView = [UIView new];
[dummyView setFrame:CGRectMake(0, 0, 200, 200)];
[dummyView setBackgroundColor:[UIColor yellowColor]];
[self.view addSubview:dummyView];}

When I run my code, the dummyView with yellow color appears on my view, yes, but with a delay of few seconds. It is really annoying!

Could you give me any idea please? When I use .xib I don't have any issues like this.

  • What should I do to show my view while my application starts without any delay?
  • Is viewDidLoad method good enough for this? How about loadView method?
  • What is the reason I had this issue on storyboard?

Updated

I'm going to upload a .gif:

在此处输入图片说明

Thank you!

I found the solution, its really silly thing. On my project there wasn't any SplashScreen. So it was immediately launch my main and it looks like views appears after some delay.

I have added SplashScreen and everything is as it should be!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM