Moving UIScrollView in App

Posted by jsetting32 on Stack Overflow See other posts from Stack Overflow or by jsetting32
Published on 2013-07-01T23:03:52Z Indexed on 2013/07/01 23:05 UTC
Read the original article Hit count: 242

Currently, I am attempting to create the same effect as Yahoo! Weather's App where the vital day information is at the bottom of the page on the top of a UIScrollView, that's contained by a UIView.

I am having a hard time thinking about how this is going to happen or how I should implement this.

If the user taps on the top of the UIScrollView which is located near the bottom of the laoded UIView, and starts to scroll up (/), the UIScrollView's frame should be moved to the TOP of the current UIView's frame.

So the UIScrollView's y-value should change to UIView's (self.view.frame.origin.y) if the user starts scrolling UP on the UIScrollView which is located on the UIView's y-pixel ~280.

Here's what the UIViewController should look like in the beginning of loading the ViewController...

Start

Then once the user slides his finger from the bottom to the top of the screen... this should happen....Finish....

And when the user scrolls to the top of the UIScrollView with all the content within it... the view should go back to the start picture shown...

How is this done?

I was thinking several UIGestureRecognizer's and Instantiating the UIscrollview at the lower part of the UIView...

_weatherView = [[UIScrollView alloc] initWithFrame:CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y + 250, self.view.bounds.size.width, self.view.bounds.size.height - 44)];
_weatherView.contentSize = CGSizeMake(self.view.bounds.size.width, self.view.bounds.size.height * 4);
_weatherView.backgroundColor = [UIColor clearColor];
[self.view addSubview:_weatherView];

The adding some UIGestureRecognizer delegate method....

But anyone have any ideas on the UIGestureRecognizer delegate method? And how it should be implemented? I can write the psuedo-code but I am having problems finding the delegate methods :P

Thank you!!! ---- Break Time.... :)

© Stack Overflow or respective owner

Related posts about uiview

Related posts about uiviewcontroller