UIScrollView not scrolling after navigating back to view in ios7 - uiscrollview

I have a project I was working on in XCode 4.whatever where the main view is a Netflix-style layout with a series of horizontally-scrolling scrollviews. The main scrollview may be scrolled vertically to see all of the horizontal ones. This is connected to a navigation controller so when an item is touched it performs a segue, whereupon the user can click a standard navigation bar back button.
This was working as expected with XCode 4.*, iOS 6.1. I have now upgraded to XCode 5 and iOS 7. The scrolling works fine upon initial load - the main vertical one and subview uiscrollviews. After navigating to an item and touching the back navigation bar button the main view won't scroll vertically. The subviews that are visible still scroll horizontally.
I am using a storyboard. The master view controller contains a Scroll View as the top item and a View with a couple subviews for the feature section at the top. The horizontal scrollviews are added programmatically.
The master view controller is a UIScrollViewDelegate and I have connected an IBOutlet from the main scrollview to my master view controller .h file.
That it works initially and then stops scrolling leads me to believe that the content size is being recalculated - and set equal to the frame size - after the navigation. However, I tried setting the content size within viewWillAppear to no avail. I did verify the routine was being called after navigation.
Any ideas on why the main scroll view loses its scrolling?

Related

xcode - how to fill a view within the bounds of main application

Im using Storyboard and I have a tableview that fits the entire viewcontroller.
When I run the app I get something like this in the footer of the app.
If you see the storyboard designer, the tableview fits the view.
So if you see there is like a gap between the bottom of the view so the tableview is not filling that gap.
Any clue?

UIScrollView contentInset is set to nonZero when using autolayout

So I have the following view hierarchy :
A full size scrollView in my viewController's view with the following constraints :
These are the constraints on containerView (ignore the second last one, its a hacky semi-fix for my problem):
I have the status bar, the navigation bar and the tab bar visible.
The thing is that when I set a breakpoint to check the scrollView's contentInset, it shows 64 on top and 49 on bottom, left and right are zero.
There is no way to set contentInset in IB, I tried setting it in an IBAction to UIEdgeInsetZeio, but that didn't fix it either. This is screwing up my scrollview by adding space above and below my contentView, how can I fix this?
By default the view controller extends the view under the top navigation bar so your content will blur under a translucent navigation bar. This is controlled by edgesForExtendLayout which is managed in Storyboard via the Extend Edges setting.
By default, the scrollview will automatically adjust its content inset so the content appears below the top layout guide. This is controlled by automaticallyAdjustsScrollViewInsets which is also managed in Storyboard.
What you did was constrain the top of your scroll view to the top layout guide instead of the top of its superview. By doing this, you manually offset it by 64 points. However, the scrollview is still automatically insetting its content by 64 points, which is why you're seeing additional space above and below your scroll view.
Either constrain your scrollview to its superview (so its content scrolls under the top/bottom bars), or disable the view controller from automatically adjusting the scroll view inset.

UIScrollview scroll not working

UIScrollview scroll is not working when i tested application in device (iPhone 5), But scroll is working properly in iPhone 5/5s/6/6 Plus simulator. I am developing application using Xcode 6 and UIStoryboard with AutoLayout.
I set the top, bottom, left and right constraints of UIScrollview with relative to Superview. And i also set the constraints of every UIControl which is in the UIScrollview.
Has any one have solution regarding this issue?
Please see below screenshot for reference.
It's probably easiest to have the scroll view contain a single view, which then contains all of your scrollable content. That single view should be anchored to all 4 sides of the scroll view, and if it's only meant to scroll vertically (which is what your screenshot makes it look like), then set the content view to be the same width as the parent of the scroll view.
To make sure an UIScrollView scroll, you have to check
Size
Your content View is bigger than your Scroll View. If you want it to be scrolled vertically, make sure its higher; horizontally, wider.
Constraints
Make sure your Scroll View is pinned to its super view, Top, Bottom, Leading, Trailing.
Make sure your Content view of Scroll View DOES NOT have CenterY constraint set to Scroll View, cause that'd make content view stuck with Scroll View and it'd never be able to scroll. (That happens to me the last time I was stuck)
Interface Builder settings
Make sure the check in Interface Builder under Scroll View is checked:
Scrolling section, Scrolling Enabled.

Top offset of TableView embeded in Navigation Controller in storyboard

I have custom TableViewController with plain style Table View and it is embeded in Navigation Controller. I use Refresh Control on the table view and Black Translucent style of the navigation bar and all is setup in storyboard.
The first row of the table view starts right under the navigation bar item, which is ok, and the rows can scroll under the navigation bar which is semi transparent. When user starts to pull the table down to activate Refresh Control, the animation of the refresh object obviously starts at the edge of the screen under the Navigation Bar, and so the refresh object is always partially covered by the navigation bar which can confuse inexperienced users.
Is there a way to tell the TableView to avoid scrolling under the navigation bar and start the refresh control object animation right under the navigation bar? I tried to play with Scroller Insets on table view without any effect.
Thank you.
If you go into the properties for the tableview controller in your storyboard, you can change the size and positioning of the tableview to start after the navigation bar. The problem isn't an offset, but the size and position of the tableview itself. Just move the y position down to accommodate the nav bar.

How to use UIScrollView with ViewControllers from Storyboard

How would I use a UIScroll view (much like the main iPhone screen) with the page control at the bottom, pass UIViewControllers?
I have three UIViewControllers,that I would like the user to swipe back and forth. However these are already created in a Storyboard. I want the entry point to be the middle viewController and have the user wipe left and right to get to the 1st and 3rd view controller.
Am I right to assume that swiping is built into scroll view's with paging enabled?
Thanks in advance
-PaulS.

Resources