Reputation: 3162
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 in storyboard?
I wrote code in ViewDidLoad but not working.
override func viewDidLoad() {
super.viewDidLoad()
self.detailWebView.frame = self.view.frame;
println("H:\(self.view.frame.height), W:\(self.view.frame.width)")
self.configureView()
}
Seem to be self.view.frame height and width that true, but size of this webview stills 320X500
Upvotes: 0
Views: 9695
Reputation: 6614
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) :
Upvotes: 4