LGSublimationView 是一个具有其在 UIScrollView 上的酷炫分页动画的视图。它产生的效果是,在滚动视图中存在一些视图,这些视图不会与滚动视图一起滚动。相反,当滚动视图进行分页时,它们会互相交叉溶解。
要运行示例项目,克隆仓库,首先从 Example 目录运行 pod install
//This is an example.
LGSublimationView *lgSublimer = [[LGSublimationView alloc]initWithFrame:self.view.bounds];
//Optional protocol methods
lgSublimer.delegate = self;
//This is just for the purposes of the demo. You probably wouldn't do this.
NSMutableArray*views = [NSMutableArray new];
for (int i = 1; i<=4; i++) {
UIImageView *view = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
view.image = [UIImage imageNamed:[NSString stringWithFormat:@"%i.jpg",i]];
view.contentMode = UIViewContentModeScaleAspectFill;
[views addObject:view];
}
//Based on how many views are in this array, will determine how many times you can scroll the scroll view which applies the sublime effect.
lgSublimer.viewsToSublime = views;
lgSublimer.titleLabelTextColor = [UIColor whiteColor];
lgSublimer.descriptionLabelTextColor = [UIColor whiteColor];
lgSublimer.titleLabelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:20];
lgSublimer.descriptionLabelFont = [UIFont fontWithName:@"HelveticaNeue-UltraLight" size:20];
//Titles are optional
lgSublimer.titleStrings = @[@"This is title one",
@"This is title two",
@"This is title three",
@"This is title four"];
//Descriptions are optional
lgSublimer.descriptionStrings = @[@"This is a description of one",
@"This is description two and also happens to be multi line, which is sweet"
,@"This is description three",
@"follow luke on twitter @lukejgeiger"];
// An optional assign property on the LGSublimer. You can use this if your views are images. It helps make the text appear more readable if there is a slight black tint over the view.
UIView* shadeView = [[UIView alloc]initWithFrame:lgSublimer.frame];
shadeView.backgroundColor = [UIColor blackColor];
shadeView.alpha = .5;
lgSublimer.inbetweenView = shadeView;
[self.view addSubview:lgSublimer];
LGSublimationView 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile
pod "LGSublimationView"
Luke Geiger, [email protected]
LGSublimationView 以 MIT 许可证提供。有关更多信息,请参阅 LICENSE 文件。