Swift how to design UIWebView Auto resize full screen in Story Board

后端 未结 1 695
轮回少年
轮回少年 2021-01-27 09:28

I designed a UIWebView with 320x500 in StoryBoard. But when run in Iphone 6 Plus Simulator, i want to this webview full screen or scale with the screen of device. How to make it

相关标签:
1条回答
  • 2021-01-27 10:20

    In ViewDidLoad and when you use autolayout, the frame is not yet calculated. So, place your code in viewDidLayoutSubviews or in viewDidAppear, and that should fix the bug.

    You can also fix that, only by adding constraints in your interface builder (do not forget to remove your code in viewDidLoad) :

    enter image description here

    0 讨论(0)
提交回复
热议问题