How to keep UIView to a maximum size in pixels on iPad but at screen size on iPhone - swift3

I have some buttons and labels on a UIView (a main view to give it a name), I want to keep this view to a maximum size on iPhones but on iPads I want to have a size no more than xxx pixels.
I have added some constrains to these buttons and labels, they position and scale well on iPhones, this is because I added to the main view some constrains to keep it 4 pixels on each side from the border. When running on iPads the view scales to the screen size, so I want to limit the size to say 700 x 400 px.

Add 2 more constraints where you set the your UIView to a height of "<= 700" and a width of "<= 400". Make the priority of the constraint 1000. Then change the constraints that set your edges to 4 to priority 990 .

Related

SWIFTUI: Scroll an image and pin it to the top of the screen

There is a scrollview in the below image (red area 1 + 2 + 3).
What I am trying to achieve is that: if I scroll up, firstly the area 1 will be up and hidden to top, then area 2 will be pinned to top and keep unmoved, area 3 can still be scroll up/down.
If I scroll down, after area 3 reaches its top, area 2 and 3 will go down together and area 1 will appear again.
Which layout could I follow?

How to set min-height on vue-chartjs

I have a chart in vue3 with vue-chart.js
When I view in mobile size the chart is too small to view in height.
How do I assign a min-height in CSS or in chart-options?
I have set the div height to 200px but the chart will still shrink as the width gets reduced.
I can set the chart-options "responsive: false" and the hiegth but the width does not follow changing size. Maybe a responsive in width but set height is the answer but not sure how to do that.
Thanks

qt set widget width according to layout'width

I have three instances of QWidget, WidgetMain and WidgetMerchandise and WidgetCentral. WidgetMain has BorderLayout, implemented in Border Layout Example. Now, WidgetMerchandise is on the west side of layout, WidgetCentral is set on Central side of layout.but I would like WidgetMerchandise to have width to 1/4 width of WidgetCentral. Do I have to reimplement sizeHint() and minimumSizeHit() or should I achieve this task using qt size policies?
The widget sizes within the same layout are controlled by stretch factors. You can call setStretch method of the layout, or your can directly set these factors in the designer mode:
The above picture shows the example of 3 widgets in one layout, and the default layoutStrech is 0,0,0 (it has the same effect as 1,1,1). You may change it to 1,4,1 for example, so the left most widget will be 1/4 width of the second (central) widget. This is the case when horizontal layout is used, where the stretch factor determines the width. Otherwise, if vertical layout is used, the stretch factor represents the ratio of heights.

Flex Slider full height and width without stretching

I need Flex Slider to occupy the entire page, like the one on this website: http://webfire.co.uk/
I've set both height and width to 100%, but when I re-size the page, it causes the image to distort and stretch. However, setting the height to auto leaves a white space underneath the slider, so it doesn't fill up the full page. The same thing happens with background-size:cover - the width becomes responsive but the height stays the same.
On the website above, they manage to sort of re-center the image when the window is re-sized.
Any suggestions? :)

Set max width of a Gtk::TextView

I've created a textview which is being filled by a Gtk::TextBuffer, however the buffer contains a lot of characters and the window gets wider than the width of the screen.
Is there a way to define a max width for a Gtk::TextView?
Put the text view in a Gtk::ScrolledWindow and set the size request of the scrolled window.