-1

I want to create a blur table view cell with a top view like in the first image here:

On iPhone 8, everything works correctly but on iPhone X after viewDidLoad it's not displaying correctly:

After changing the ViewController and switching back it's working fine:

My hierarchy is as follows:

It's created in Swift 4.

Does anyone have experience with that problem? Thanks in advance!

jvarela
  • 3,744
  • 1
  • 22
  • 43
flapper86
  • 1
  • 1
  • 3

1 Answers1

0

I had the same problem in my app. What actually happens is the Xcode picks up the default storyboard of your Main.storyboard for the build. This error occurs on all the devices which have the width greater than 375. Try testing your build with iPhone X as storyboard default or call layoutSubViews() at the end of viewDidLoad.

  • Hey Jai, thank you - what do you mean with layoutSubViews() ? – flapper86 Dec 23 '19 at 14:08
  • layoutSubViews() is an inbuilt function which should be called whenever there is change in constraints because updating constraints by code does not gets reflected for more details check the link. https://stackoverflow.com/questions/728372/when-is-layoutsubviews-called – Jai Nijhawan Dec 24 '19 at 06:44
  • When I call the function myView.layoutSubViews() in viewDidLoad nothing happens :-( Is something wrong? – flapper86 Dec 25 '19 at 12:00