MMParallaxPresenter 是一个显示文本/视图的 UIScrollView,具有垂直视差效果。
pod 'VAProgressCircle'
添加到您的 podfile,或您可以将 MMParallaxPage.h/.m
和 MMParallaxPresenter.h/.m
手动添加到您的项目中,来使用 Cocoapods 安装 MMParallaxPresenter@property (weak, nonatomic) IBOutlet MMParallaxPresenter *mmParallaxPresenter;
并不要忘记在 Interface Builder 中链接它将 MMParallaxPage 添加到 MMScrollPresenter。为此,您有三种初始化方法可供选择。默认视图按上述 gif 的顺序显示
- (id)initWithScrollFrame:(CGRect)scrollFrame withHeaderHeight:(int)height
andContentText:(NSString *)contentText;
- (id)initWithScrollFrame:(CGRect)scrollFrame withHeaderHeight:(int)height
withContentText:(NSString *)contentText andContextImage:(UIImage *)image;
- (id)initWithScrollFrame:(CGRect)scrollFrame withHeaderHeight:(int)height
andContentView:(UIView *)contentView;
这显示了如何初始化一个页面并将其添加到您的演示者中
MMParallaxPage *page1 = [[MMParallaxPage alloc]
initWithScrollFrame:self.mmParallaxPresenter.frame
withHeaderHeight:150 andContentText:[self sampleText]];
page1.headerLabel.text = @"Section 1";
[page1.headerView addSubview:[[UIImageView alloc]
initWithImage:[UIImage imageNamed:@"stars.jpeg"]]];
[self.scrollView addParallaxPageArray:@[page1]];
MMParallaxPresenter 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。