iOS7 - unable to embed a screen in a scrollview - ios

I have a screen that doesn't fit into a 3.5 inch phone screen. In iOS 6 I had the contents of the screen in a scroll view, but in iOS 7 that option is constantly grayed out.
Here is the screen shot
Would anyone know how to add the scrolling to my screen in ios 7?
Thank you!
Second screen shot with the scroll view.

Rather than selecting the entire view controller, you need to have a view selected. The options in Editor -> Embed In are contextual and since you have then entire view controller selected, your only options are to embed the whole VC within a Navigation Controller or a Tab Bar Controller.
If you can't get the right selection by clicking within Interface Builder, try expanding the outline view and selecting your view. Then try to embed your view within a scrollview.
Note that your root view must be a UIView, so you won't be able to embed the root view in a scrollview because that would put a scroll view at the root.

Three problems I ran into that I hope can help:
1) Make sure "Safe Area", or other object that shouldn't be there, isn't one of the objects selected in your view while trying to embed. For a simple test select just one simple object like a textfield or label and see if the Editor -> Embed In is still greyed out and work backwards if you have to.
2) You're going from View > Content to View > ScrollView > View > Content. So after embedding in a scrollview, embed in a view.
3) Once embedded make sure your scrollview is less than your content size, or it won't scroll: https://stackoverflow.com/a/28146729/1323357

Related

UIView inside UIScrollerView displays with -64 offset

I'm trying to create a form that will be larger than the screen size and I've decided to use a view inside a scrollerview, then I'm adding the rest of the UI widgets (textfields, buttons, etc.) inside the view.
The view displays and scrolls, but no matter what I try, it displays with a vertical offset of -64 below the navigation controller bar. Once there the view will happily scroll up down.
I want the view to anchored at the top, just below the navigation bar, and then scroll down.
I am using IB.
Lots of time researching and not many answers that have worked for me. UIScrollView seems to be like one of those dirty secrets the whole iOS world seems to avoid....
Thank you for your help.
You can fix this in the storyboard
1- Select the view Controller
2- GO to attributes inspector
3- Uncheck adjust scroll View insets
For your view controller, in the storyboard uncheck the option to extend edges under top bar.

Weird scrolling behaviour when using Tab Controller - iOS

I am building an iOS app using Swift. In my app, I am using a paging menu controller (called PageMenu) built from other view controllers placed inside a scroll view (you can view it on GitHub here). It is similar to how Instagram looks:
When I set up the PageMenu in my project, it looks and works great...
BUT, when I embed the view within a Tab Bar Controller to add in a normal iOS Tab Bar, the scrolling within the PageMenu view doesn't work...and I get weird diagonal scrolling, and I can't actually scroll down if there is more content.
Does anyone have any idea of why this might be happening and how to fix it?
Please ensure that you set up the frame size when you are initializing the page menu.
If your scroll view is bigger than the actual view, then you will only be able to scroll the view, and not scroll the content inside it properly.
Set up the frame size of view while embedding. Check the parent view frame size.

Using Autolayout and universal storyboard super view is not taking the full screen?

I am developing an iOS application using Universal Story board and autolayout. The base views of my view controllers are leaving a space at the bottom and are not taking the full height of the screen. What could be the reason behind this?
Go to property area in the storyboard and choose your main view then select all the lines which is available in that area. then it holds the full view of the page.
It looks like your view is taking up the whole screen but is hidden behind a tab bar.
This will happen when you include them inside of a UITabbarController. The reason they reach down underneath the tab bar is because it is translucent (you can see a blurred version of the view through it).
This tutorial from Ray Wenderlich gives a good example and explanation of how to set this up in a storyboard.
https://www.raywenderlich.com/50308/storyboards-tutorial-in-ios-7-part-1
Actually the "Show Toolbar" option for my navigation controller was checked. The space at the bottom was taken by the toolbar.

control-drag from view controller in ipad storyboard to toolbar not auto-scrolling storyboard

I just saw a video demo of control-dragging from the view controller icon for an ipad storyboard at the bottom of a view controller to the toolbar within that view controller. While the view controller icon and the toolbar are not on the screen at the same time, the dragging actually scrolls the storyboard enabling the connection between the two.
However, in my ipad storyboard I am unable to make that auto-scrolling happen and thus unable to complete the control-drag.
Is there a way to make the storyboard scrolling happen while control dragging? I thought of temporarily moving the toolbar to the bottom of the screen to make the connection and then moving it back. But the storyboard won't auto-scroll to let me do that either. I'm using a 13" macbook pro. There appears to be no zoom setting that will have both on the screen at the same time.
Alternately, can someone tell me if there is an alternate way to accomplish that? Which part of the code would I control-drag to?
Thanks.
according to this, one can accomplish the same by control-dragging to the icon of the corresponding element (in my case the toolbar) in "document outline pane" which sits between the project navigator and the (storyboard) canvas.
http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/SecondiOSAppTutorial/GettingStarted/GettingStarted.html
doing so would bypass the inability to autoscroll within the storyboard.

Toolbar hiding on rotated UISplitView DetailView

I've based my app on Apple's SplitView project type. I have a TableView as the Master, and am using different types of views as the Detail view. To select types of detail view, I'm using the fancy concept of buttons on my DetailView toolbar. When the DetailView is derived from UIViewController, everything is good. When the DetailView derives from UIViewController, but contains a UITableView then I have problems. In portrait view the toolbar is visible. In landscape mode the toolbar is hidden, even though the Tableview is moved down to allow space for it. The UIToolbar and UITableView are both defined in my NIB file which is loaded to create the detail view. Why is my toolbar invisible in landscape?
BTW, is this the best way to choose Detail view types with UISplitView? Bonus question, what if selecting a row in my DetailView tableview should bring up another View, I can't push it like I would with a NaviagtionController, so how do I go back to the detail tableview?
Thanks, Gerry
HI Gerry,
I have faced the same toolbar problem, when trying to rotate the splitView, toolbar will disappear. If you are creating the toolbar in the interface builder, try to set the toolbar properties(size), by selecting the toolbar, then --> Tools -->Size inspector, in the autosizing section, mark the left, right and upper red lines and unmark the bottom red line, then everything will works fine.
-Maria
Bonus question, I would create a UINavigationController in code, set it's rootcontroller to the DetailView tableview (self) and then push the new view on top of it.
When you react to the rotation change are you using the same view or a different one for the detail view? Seems like the new view may not contain an instance of the toolbar? Or the Tableview is covering it up because the landscape view has less vertical room than the portrait view. Are you resetting the height of the tableview to allow space for the toolbar within the 768 height when rotating to landscape?
Just a tip but whenever I run into odd things like this I remove the elements from the NIB file and create them programmatically in code and it usually solves the problem. You get a lot more control over things when you do. Overall as I've gained more experience with programming for iPhone OS I've found that I rarely put much into a NIB file any longer and do almost everything in code now.

Resources