Scrollview in Xcode6 is ridiculing me a bit.
I have added a scrollview, and a content view inside the scroll view.
The content view has some various sub views.
My problem is with the new layout in Xcode where it's the w Any by h Any - adaptive layout or what they call it.
The problem is that the content view is suddenly 600 pixels wide so I get some horizontally scrolling, which I do not want.
I simply want the content view's size to be as wide as the device.
Ahh - I found the answer. Simply add a constraint making the scroll view and content view the same width.
Related
We have a table view with prototype cells in a storyboard that work well in iOS 7 to 9. The content of the cells is layed out with AutoLayout.
In iOS 10, the prototype cell does not display its content. The cell is black.
If I run the view debugger and show the clipped content, I see the cell's content being shown. Part of it is within the cell's bounds, part of it outside. Even then, the content's position does not correspond to the layout constraints.
Also, when looking at the view hierarchy on the left hand side of the view debugger, I can see that the cell has no children.
Deleting this line fixed the issue:
expiryDetailsTableViewCell.translatesAutoresizingMaskIntoConstraints = NO;
I am trying to create a grid layout of images kind of like how google images does it.
I want to add fixed sized images left to right, top to bottom but I am having trouble is figuring out when adding another image to a row would make it not fit and then decide that that images should be placed in a new row.
Also when the window resizes it should move images into/from rows based on how many it can fit in.
Ive got a scroll area with a grid layout in it which is fine if I know what can fit, but I can't figure out how to make it move items if say the window width is shrunk, and say an item needs to be moved down 1 row which moves other etc.
Assuming you are using QWidgets I'd suggest you to use QListView which does the layouting for free, if you want more control on how items are displayed use a QItemDelegate. For QListView the view mode should be set to QListView::IconMode so that you have a grid of items and not a list.
But if you are using QtQuick things are much easier, a GridView with Image delegates would do what you want really quickly and using GPU power to build you UI.
I reimplement a QScrollArea and I want to add several widgets to it at runtime. The problem is, till the scrollbars are shown the content of the QScrollArea doesn't fit to it. Only if I add more widgets so the scrollbars shown the content fits correctly.
I already tried this after adding widgets
this->widget()->resize(this->widget()->sizeHint());
or
this->widget()->adjustSize();
But this doesn't worked. What I have to do to resize the content? Why the content fits after the scrollbars appear?
Add an appropriate layout to your scroll area before setting a widget.
Set the size constraints(min and max property ) of the widgets being added
I am not sure about your widget layout inside the scroll area, but you can make use of spacers to align the widgets ( when initially there are not many widgets to fill the scroll area for the scroll bar to appear)
I am trying to get a livecycle image field to be right up against the side of the page that it is on. It seems that I always have a little space between the image and the edge of the page no matter what I do.
Here is an image so you can see the problem: http://imgur.com/4WVVudi
The person should be on the edge of the page, he should be touching the bottom and right side.
Thanks!
Is the image on a master page or just within the content pages/subforms?
If the image is in the content pages check that the 'content area' in the master page is the full width and height of the page (use the information in the layout tab).
For precise positioning choose anchor bottom right and use the x and y co-ordinates in the layout tab.
cheers
Use the layout panel to check and set values for the content area width that contains your image field. Also set the width and positioning for the parent subform if you have the image in a subform.
One of the screens in my app has to be vertically scrollable. Its contents is more or less static, but it doesn't fit on the phone's screen (hence the scroll view). I'm using a UIScrollController as a top view, and I'd like to use the storyboard editor in Xcode to lay out all the views in it. Can I do that? I can obviously drop things on the visible part of my UIScrollController, but can I put more views "below the fold" visually?
There is another way to do it that is different from the answers given in the link in the comment above which I believe is easier because it allows you to see your whole content view at full size and design it in Storyboard.
1)Place a UIScrollView as the root view of the controller.
2) Click on the View Controller in storyboard and goto the
Attribute Inspector and change the Size to Freeform
3) Click on the Scroll View in storyboard and goto the Size
Inspector and change the Width & Height to as big as you need.
(2,000 x 4,000)
4)Place a UIView as a subview of the scrollview, this will be your
Content View where you will design your screen and put all your
subviews. Don't forget to set the contentSize of the scrollview to
the size of this view in viewDidLoad.
5) Click on the UIView from #4 and in the Size Inspector set the Struts and Springs so
this view is not resized .
6) Design the rest of the screen
The trick is in #3 & #5 setting the size of the scrollView to really large so you can design. When this viewController is loaded into the iPhone the Struts & Springs will resize the scrollView to the size of the iPhone screen, but the contentView will stay large.
It's possible finally in Xcode 11!
Select some view inside your scroll view in the View Tree and then scroll with your touchpad/mouse: