I've been playing around with adding different interactions to a test project of mine, and I'm having trouble adding something like Facebook's post status bar, the one that sits on the timeline scrollview and scrolls with the scrollview when you're scrolling down the view but stays stuck under the navbar when you're scrolling up it.
I've been creating a separate UIViewController (not UIView) and adding it as a subview to the main ViewController. I'm not exactly too sure where to go from there though... How does the new view scroll with the scrollview? Should I even be using a separate viewcontroller?
Any help would be greatly appreciated! Thanks!
Here's some sample code you can use to get started, just add it to your view controller. It uses a generic
UIView
for the floating bar and a genericUIScrollView
for the scroll view but you can change that to whatever you want.And in the
@implementation
add:You should be doing it as a
UIView
, not aUIViewController
. The general rule in iOS development is that view controllers take up the entire screen and views are used for "subviews" that take up part of the screen (though this is less the case for iPad). Either way, aUIViewController
has it's own lifecycle (willAppear
,didAppear
, etc.) which is not needed/wanted for the floating bar so it should definitely be aUIView
.