scalessec / CSLinearLayoutView

Linear layout view designed to simplify relative layouts on iOS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Creating parallax effect when scrolling layout.

hrsalehi opened this issue · comments

I have a layout with an image above it and I want to image scroll faster that the other view. Is this possible? I set the main view delegate UIScrollViewDelegate and in viewDidScroll can get the scroling action but the frame of subviews doesn't change

Assume I want to subview1 scroll with 2 times speed of normal scrolling:
(void)scrollViewDidScroll:(UIScrollView _)scrollView
{
float y = scrollView.contentOffset.y;
CGRect gallRect = _viewGallery.frame;
gallRect.origin.y = y_2;
_viewGallery.frame = gallRect;
}

but nothing happen.