Scroll view like Star Wars opening crawl.
##Requirements
iOS5.1 or later
##Installing By using CocoaPods
pod 'SWScrollView', '~> 0.0.1'
##Usage
Import header
#import "SWScrollView.h"
Instantiate SWScrollView along with start point and add view on any other view that you want.
CGPoint scrollStartPoint = CGPointMake(0, -600);
SWScrollView *scrollView = [SWScrollView scrollViewWithStartPoint:scrollStartPoint];
[self.view addSubview:scrollView];
If you want start animating automatically, call following method.
[scrollView startAnimationWithDuration:12.f completion:^(BOOL finished) {
// Write what you to do when finished this animation.
}];
##Customize
###Crawling message
Of course You can change crawling message in SWScrollView.xib
.
###Perspective of scroll view
If you want to change perspective of scroll view. Edit -(void)setupScrollPerspective
method in SWScrollView.m
.
- (void)setupScrollPerspective
{
CATransform3D transform = CATransform3DIdentity;
//z distance
float distance = [[UIScreen mainScreen] bounds].size.height;
float ratio = [[UIScreen mainScreen] bounds].size.height/[[UIScreen mainScreen] bounds].size.height;
transform.m34 = - ratio / distance;
transform = CATransform3DRotate(transform, 60.0f * M_PI / 180.0f, 1.f, 0.0f, 0.0f);
self.layer.transform = transform;
self.layer.zPosition = distance * ratio;
self.layer.position = CGPointMake([[UIScreen mainScreen] bounds].size.width/2,
[[UIScreen mainScreen] bounds].size.height/3);
}