0

In my controller I'm loading all its content programmatically inside the viewDidLoad method, and everything has always worked just fine. However I'm implementing a new feature which is just a view to show at a certain point, and I decided, in order to save time, to design the view in IB and load it from the xib.

This view consists of a main UIView (with a colored background) and two subviews: a label and an imageview.

the code I use to load it is the following:

- (void) configureNoConnectionView{

    self.noConnectionView = [[[NSBundle mainBundle] loadNibNamed:@"NoConnectionView" owner:nil options:nil] lastObject];

    [self.view addSubview: _noConnectionView];
    [self.view bringSubviewToFront: _noConnectionView];

}

However, If I call this method inside the viewDidLoad only the label is displayed correctly, the "main view" with the colored background and the imageview are just hidden. If I call this method inside the viewDidAppear everything works just fine.

I'd like to understand why this is happening, why just the label and why this goes wrong if, in the same time, every layout I make in my VC's is being made, programmatically, in viewDidLoad.

dev_mush
  • 2,136
  • 3
  • 22
  • 38

0 Answers0