MM滚动演示器是一个用于iOS开发的控件,它接受一个MM滚动页面的数组,并在UIScrollView中显示它们。
我最初是受到《命运》应用中的控件的启发,所以我建议您也检查一下那个。
pod 'MMScrollPresenter'
添加到您的podfile中来通过Cocoapods安装MM滚动演示器,或者您可以手动包含MMScrollPresenter.h/.m
、MMScrollPage.h/.m
、arrow/@2x.png
到您的应用中。@property (nonatomic, weak) IBOutlet MMScrollPresenter *mmScrollPresenter;
到您的属性列表中,并在Interface Builder中将其链接起来。将MM滚动页面添加到MM滚动演示器中。
UIImageView *mountainImage = [[UIImageView alloc] initWithImage:[UIImage
imageNamed:@"mountains.jpg"]];
[mountainImage setFrame:CGRectMake(0, 0, self.mmScrollPresenter.frame.size.width,
self.mmScrollPresenter.frame.size.height)];
MMScrollPage *firstPage = [[MMScrollPage alloc] init];
firstPage.titleLabel.text = @"Look a picture of mountains";
firstPage.detailLabel.text = @"I'm the detail text";
[firstPage.backgroundView addSubview:mountainImage];
firstPage.titleBackgroundColor =
[UIColor colorWithRed:119/255.0f green:92/255.0f blue:166/255.0f alpha:0.5];
[self.mmScrollPresenter setupViewsWithArray:@[firstPage]];
MM滚动演示器可在MIT许可下使用。有关更多信息,请参阅LICENSE文件。