R
R
rksdricloud2014-11-22 13:51:44
iOS
rksdricloud, 2014-11-22 13:51:44

How to make WebView dynamic size?

I am writing my first application in Swift.
I can't seem to get the WebView to resize to the size of the device.
That is, it is required to make height: 100% and width: 100%.
Thank you all in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
An, 2014-11-22
@Flanker_4

There are two options:
1) Right-click on the UIWebView in IB and drag to the parent view (it's easier to do in the navigator on the left), set Center X for the first time, drag again and select Center Y, Equal Width, Equal Height. Well, i.e. centered in the parent view and the same size with it.
The same can be done in those menus that you have shown on the screen, but dragging and dropping like this is faster :)
2) Set Leading, Tralling, Top, Bottom to 0 , or as many as you need there (for this, on the screen shown, you need to click on the red lines of this form |-|, for all 4 pieces. In the same place, check the boxes against width height and be sure to press the button at the bottom of AddConstraints (in brackets there will be their number, namely 6 pcs.) After that, select webView and in the properties (panel on the left) on the dimensions tab find the constraint width and height and change their type from equal to (=) to >= Well, specify the minimum size, for example, 10 pixels. This will mean the following - nail the view to the boundaries of the parent, while it is possible to change the height and width, but not less than such and such a value

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question