Storyboard UIView cuts off objects when scrolling - ios

Using Storyboards, I have a scrollview with a UIView embeded into it. On that UIView I have some text and a button. The button is down a bit, for this question.
When I scroll in the simulator and on the device, the UIView gets cut off where the button is. (button there to show the cut off)
Above pic is before scrolling.
This pic is showing the scroll UIView and the button embeded into it being cut off.
I have set the Size Inspector to 1000 height.
I have searched on stackoverflow and I have not found an answer as of yet.
Thanks for any help.

It looks like the hierarchy of this particular window is not ordered properly. You need to rearrange your hierarchy. To do this, go to your storyboard, and click on the little button on the bottom left that looks like the play button with a box around it. From there, you can adjust.

I had the same issue in an app i was working on. For some reason, it didn't work for me either. I suggest you try creating the the scrollview and the view inside it programatically instead of storyboard for this particular view controller. It will work like a charm. You will also have to find the length of the inner view and then set the size of the scroll view to the size of the view embedded in it.

I figured it out. Not sure if this is the preferred method or just a work around.
The main difference is I connected the last ScrollView, not the First one. Not sure why but it works.
Before, (pics above in original post with cut off button), it would cut off my UIView. I still would like to know "why" it does this. Thanks for the reply's.

Related

How to set iOS ScrollView in DetailViewControl?

You need a scroll view to implement it as shown in the picture above. But I don't know how to implement it. That's the only thing on the storyboard that's missing.
And when you run it, you just move the scroll bar next to the screen, and there's no change on the screen.
Do you have any suggestions?
Have you tried to deselect Content Layout Guides?

How to display UIView that's outside of screen in main.storyboard?

I'm working on a screen that has a UITableView below the screen(thus invisible) initially, but will pop up when user click on a button. I know it's not supposed to be seen on the screen, but just for the sake of design, is there a way to make it visible when I'm working on main.storyboard?
Please see the picture attached below. It's really hard to work on the UITableView when it's beneath the toolbar. How can I force xcode to display them so it's much easier to work on?
You can't, but you have 3 workarounds:
Move it into view (Xcode will complain that it's not in the right position, but it doesn't matter)
On the bottom left on your storyboard, you can open up the view hierarchy, you can find your element there for creating constraints, linking it with your code and everything else you'd want to do.
Increase the visible size of the viewcontroller on your storyboard, trough selecting your viewcontroller on the storyboard, changing Simulated Size to freeform and increasing the values (will not affect size when running).
The easiest way to deal with this is to:
open storyboard
select the viewcontroller you want to edit
open the Size Inspector
Switch from Fixed to Freeform
Type in a larger height (like 1000)
Simplest thing is to manually do what your button does in the app.
In the view hierarchy on the left, select your table view and move it down to the bottom. This will bring it to the front in interface builder.
When you are done, move it back.
I do this all the time and you get used to doing it. Just watch out for accidentally moving it inside another view when you drag it down or up.

Placing a control over a mapview iOS 7 using storyboards

I'm trying to place a button over a mapview. In storyboard I have it as the last control in the view hierarchy, the map view still covers it up. I've tried adding this line in my viewDidLoad method to bring my button view to the front but it doesnt seem to work either
[self.view bringSubviewToFront:self.flagButton];
anyone have any idea why this wouldnt be working? the map view covers most of the screen, and I want to place a few buttons on top of the map, but so far can't get them to show up, they are under it every time.
I was able to do this by making my view as subview of map view.
first,
self.view = self.gmsMapView;
then,
[self.gmsMapView addSubview:_myBtnView];
I know this is an old post, but I'm answering for the sake of someone facing the same problem.
I was having the same issue, then I found a solution, and is as follows:
First, open your project and go to your StoryBoard then click on "Show Document Outline" switch that is on bottom left very small switch. After that select your "Scene" that you are having problems with then click "View". Find your MKMapView object and drag it up until you reach the first row. This will make your MKMapView object (or any other) "the first in a layer" so to speak.
I hope someone will find this helpful.
E
I was using storyboards and was not seeing the button. I had to set the MKMapView to hidden until the button was displayed and in position. Then I set the MKMapView to visible.
Here are the steps I had to take in the interface builder to get my button to show
Create a UIViewController which contains a view
Add an MKMapView and set constraints
Add UIButton in the same view as the MKMapView, set the image and text, whatever is applicable. If MKMapView disappear when you try to resize or move the button, the map view has just set its width and height to zero. Enter new values in the Size Inspector for the map view and it will resize back. Or you can move the button elsewhere off the MKMapView and then move the button back to where you want it.
The important part is to set constraints for the UIButton. I also had to set the MKMapView hidden until I got the size and placement right and then set it back to visible.
Here's how it looks in the simulator
You can't add a subview to an MKMapView via the storyboard. Add it as a sibling view instead.
Edit: Your map view should also be a subview of the root view (i.e. self.view) for this to work.
I was having similar issues and I did the following:
Made sure both the map view and the button are at the same level in the view hierarchy, I accomplished this by creating a View that both the map view and button were children of.
Made sure the button is dragged below the map view in the left gutter of the storyboard (so it is actually rendered on top).
Made sure there were valid constraints for the button.
The only thing new that hasn't already been mentioned was double-checking the constraints, and that appeared to resolve it for me. Hope that helps.

ViewController gets misplaced, when a view size is adjusted

I'm quite new to the Xcode programming. I've added some view controller, labels, buttons and image view to my program, but, when I try to adjust, for example, the size of a label, the view controller that that label is in, gets displaced. I mean, when I try to drag the side of the label to change its size, the view controller moves down, making my label get displaced in the view controller. It is a very weird situation, here you have the screenshot of my project, the view controller misplaced is the one that says "Perfil" on the navigation bar. Every time I try to change one of those light blue views size, the entire view controller changes place. The more I try to change the side the more it will go down.
Sorry for my English, not my native language.
I think the bigger issue is that you are using Table View Cells that are not part of a table view.
Table ViewCells are supposed to be a part of a UITableView and not just stuck in a view.
Using UITableViewCells in this way is what is causing the strange behavior.
If you are trying to make a table, put a UITableView in your view, and then you can customize the table view cells in there.
It you aren't trying to make a table, just use UIView's instead of those UITableViewCells.
I have two ideas that may fix the problem:
First, if you're trying to drag and drop the label but the view controller moves instead, then you might just be grabbing the view controller's background by mistake. When this happened to me, it was because the order of my components in the xib file was wrong. Things are ordered from back to front, and when you click and drag something, you'll just be clicking and dragging whatever's on top. You can try and get past this by clicking the UI element on the left to be sure you select it, then dragging the handles.
It looks like you have things in a reasonable order, so that may not be the culprit at all.
Second, if that doesn't work, select the element you want to edit on the left, then open up the utilities pane on the right. Click the Attributes icon (should be fourth from the left) and look towards the bottom. You should see something like this:
Just manually edit the position and size of your labels there. You should see the change immediately reflected in the display.
Hope this helps!
Setting no autoresize behavior in Interface Builder solves the issue.

Unwanted UITableView Animation

I have a simple UIViewController_A in a Storyboard with a button on it. The button modal segues (page curl) to UIViewController_B which has a container view. The container view then embeds UITableViewController_A. The table displays 1 section containing 3 custom static cells. Each cell has a label on the left and a switch on the right.
When I click on the button, the table is properly displayed where I want it but the cells content, labels and switches, are animated to their positions.
How can I disable this animation? I suspect it is the embedded tableview getting animated while being resized, but am not sure.
I put a simple demo of the problem on github : https://github.com/droussel/UnwantedAnimation
Thanks!
I noticed that only the middle cell animates in. If I increase the cells to 5, the middle 3 animate. This only happens with the partial curl animation -- this looks like a bug in the auto layout system to me. If you turn off auto layout, the problem goes away.
I don't know much about storyboard concept.But I suspect you are starting some animation in button action to have an animation like paging.If so, then just commit(end) your animation after achieved what you want.
[UIView commitAnimations];
Hope it will help you.
In Storyboard segue to that scene/view, open the Attributes inspector, and uncheck ANIMATES. Turns out there is a bug with iOS8 with Partial Curl/Animates.
Hope that helps!

Resources