I would like to move a textview inside a container view without deleting or re-creating them. How can I do it using my storyboard ? I just want to move highlighted Text View inside to Container View. Drag & Drop is not working, it is just changing the order of views.
Guidance needed. Thanks.
If container view is of container kind. Drag should work I believe. Just drag your textView over containerView and hold until your container get surrounded by blue line like in image then drop it there.
If you see here I am dragging and dropping Label 0 - 12 inside a collection view.
Related
I have a view controller which contains a table view controller embedded in a container view:
What you see inside the view controller on the left is a container view that embeds the table view controller through a storyboard segue. And like you see in the image, there is also a constraint that specifies a top space between the container view and the above segmented control.
When I launch the application everything is normal and I can see a separation space between the segmented control and the table view cells. But as I scroll down, as you see in the blow picture the table view cells overlap with the segmented control:
By debugging the view hierarchy I found out that the problem is that the cells are displayed even if they are outside of the container view:
What you see in the above pictures are the table view cells and the container view. I've drawn two red lines, one starting from the container view top and one starting from the top of the first table view cell and like you see the table view cells go beyond the bounds of the container view, which means that they are visible even if they are outside of the table view area. Instead, the container view which embeds the table view is below the segmented control and the separation space imposed by the constraints is respected.
Can you try setup clipsToBounds? It can be help.
tableView.clipsToBounds = true
Must be something to do with how you've laid out your constraints. Hard to tell by the pictures.
I set a height constraint to the view that has the segmented control. And set the vertical spacing between that view and the container view to 0.
I uploaded a demo project here.
My iOS app view has a cover Image at top (100% width, 30% height) and a Table for the rest of the screen. To acheive this kind of layout, I am using "Container Views" in my view. So I have Two Container Views:
1st Container is normal view controller with UIImage.
2nd Container is Table View Controller. This can have many entries.
When I run this and try to scroll, only the second container scrolls in place. 1st container remains at the top.
How can I make the full parent view to scroll instead of just second view.
(Are container views right bet for this kind of requirement and layout?)
you may create a new cell called "HeaderImageCell", and make the first cell to be "headerImageCell"
"Container Views" is not needed at this point.
I have a view that looks like this.
Container View 3&4 are stacked together on the far right.
3rd container view is under the 4th container view.
I want the views to be stacked, however the 3rd container view gets pushed down to the bottom below the 4th container view.
Why is this and how can I prevent this from happening?
The issue was that despite removing the 3rd container view, my view was still not showing up.
I add to bring it to the front.
[self.view bringSubviewToFront: self.fourthContainerView];
I'm trying to add my custom ContainerView to an usual ViewController using StoryBoard (iOS7).
I only have a TableView Controller on this view. If I move the ContainerView inside the TableView it is displayed (but moved with the table items), but if I place it directly on view it is not displayed any more! Any ideas?
There appears to be a bug in Xcode/iOS where if the container view is the first child of self.view in storyboard, it doesn't show. For example when I have:
my container doesn't show.
But if I move the label above the container view in the outline:
Then my container view and the label will show.
UPDATE: Upon further investigation it appears the container view does still show if it is the first child, just much lower than you would expect it to appear. Placing another element above the container view allows the container to appear in the position you would expect (the position shown in storyboard).
I have a screen in my storyboard where I would like to embed a container view into a portion of the screen. I can't figure out if I should add a new containerview or view from the object library and then drag in a collection view controller or collection view (or tackle it a different way?). I've tried all combinations but just end up with the embedded view being shown black even if I drag collection view cells and set a background colour to test it. Once I can get this working I plan to populate the cells from an external database.
Any suggestions please? I'm doing this using storyboard as far as possible.
Thank you.
After you drag a container view into your view, you automatically get an embedded view controller, whose size is matched to the container view's size. You should delete that controller, and drag in a UICollectionViewController. Control drag from the container view to this controller and choose embed when you let go -- this will resize the collection view controller. You can give the collection view a background color, so you will see where it is, but giving the cells a background color won't show up until you implement the methods in the controller to populate those cells.