How to set up iOS storyboard for bounce modes like Instagram Stream?

I am creating an application with a stream of social content and trying to understand how instagram works in the application. So basically the top header, which scrolls from the screen but bounces between this and the content. I can make the top title scroll from the screen, and I can make the view not rebound, but I want to use Pull to update, and this ends above the faux navigation bar UIView. I know that a regular Navbar will produce this, but this one that scrolls is a completely different story.

I currently have one UITableviewthat has UIViewhigher UITableViewCell, and everything works fine, except that bounce happens higher UIView. I suppose I need to get UIViewhigher UITableview, however in the UITableViewController the storyboard will not let me post UIViewover UITableview.

Any ideas ???

thank

+5
source share
1 answer

Well, I finally got everything to work, so I decided to post an answer for everyone.

Basically I set the standard navigation bar, and then on scrollViewDidScrollI get the scroll offset and change the frame based on this. It seems to work fine, see below my scrollViewDidScroll method.

- (void)scrollViewDidScroll:(UIScrollView *)sender {

    //Initializing the views and the new frame sizes.
    UINavigationBar *navbar = self.navigationController.navigationBar;
    UIView *tableView = self.view;

    CGRect navBarFrame = self.navigationController.navigationBar.frame;
    CGRect tableFrame = self.view.frame;

    //changing the origin.y based on the current scroll view.
    //Adding +20 for the Status Bar since the offset is tied into that.
    navBarFrame.origin.y = MIN(0, (sender.contentOffset.y * -1)) +20;
    navbar.frame = navBarFrame;

    tableFrame.origin.y = MIN(0,MAX(-44,(sender.contentOffset.y * -1)));
    tableView.frame = tableFrame;

}

TableView 44px , , . viewWillAppear .

+5

All Articles