这是一个小型项目,实现了 Path 3.X 应用程序中介绍的新教程。非常简单高效的教程,由 N 张全屏图片组成,您可以滑动切换到下一页/上一页。
以下是功能特点:
代码已注释,很容易阅读、理解或修改。所有可用的滚动设置都位于头文件中:ICETutorial.h
文本和图片
// Init the pages texts, and pictures.
ICETutorialPage *layer1 = [[ICETutorialPage alloc] initWithSubTitle:@"Picture 1"
description:@"Champs-Elysées by night"
pictureName:@"[email protected]"];
ICETutorialPage *layer2 = [[ICETutorialPage alloc] initWithSubTitle:@"Picture 2"
description:@"The Eiffel Tower with\n cloudy weather"
pictureName:@"[email protected]"];
[...]
子标题和描述的常见样式
// Set the common style for SubTitles and Description (can be overrided on each page).
ICETutorialLabelStyle *subStyle = [[ICETutorialLabelStyle alloc] init];
[subStyle setFont:TUTORIAL_SUB_TITLE_FONT];
[subStyle setTextColor:TUTORIAL_LABEL_TEXT_COLOR];
[subStyle setLinesNumber:TUTORIAL_SUB_TITLE_LINES_NUMBER];
[subStyle setOffset:TUTORIAL_SUB_TITLE_OFFSET];
ICETutorialLabelStyle *descStyle = [[ICETutorialLabelStyle alloc] init];
[descStyle setFont:TUTORIAL_DESC_FONT];
[descStyle setTextColor:TUTORIAL_LABEL_TEXT_COLOR];
[descStyle setLinesNumber:TUTORIAL_DESC_LINES_NUMBER];
[descStyle setOffset:TUTORIAL_DESC_OFFSET];
// Load into an array.
NSArray *tutorialLayers = @[layer1,layer2,layer3,layer4,layer5];
初始化和加载
self.viewController = [[ICETutorialController alloc] initWithNibName:@"ICETutorialController_iPhone"
bundle:nil
andPages:tutorialLayers];
// Set the common styles, and start scrolling (auto scroll, and looping enabled by default)
[self.viewController setCommonPageSubTitleStyle:subStyle];
[self.viewController setCommonPageDescriptionStyle:descStyle];
// Set button 1 action.
[self.viewController setButton1Block:^(UIButton *button){
NSLog(@"Button 1 pressed.");
}];
// Set button 2 action, stop the scrolling.
__unsafe_unretained typeof(self) weakSelf = self;
[self.viewController setButton2Block:^(UIButton *button){
NSLog(@"Button 2 pressed.");
NSLog(@"Auto-scrolling stopped.");
[weakSelf.viewController stopScrolling];
}];
// Run it.
[self.viewController startScrolling];
标题位于 ICETutorial.m
// Setup the Title Label.
- (void)setOverlayTitle{
// ...or change by an UIImageView if you need it.
[_overlayTitle setText:@"Welcome"];
}
查看我的账户上可用的其他项目 @Icepat。
问题和想法:《a href="/cdn-cgi/l/email-protection#611100151308020a4f1513080d0d12000c21060c00080d4f020e0c">[email protected]。
MIT 许可证
版权所有 (c) 2013 Patrick Trillsam - ICETutorial
在此,免费允许任何获得此软件及其相关文档副本(“软件”)的人在该软件上无限制地处理软件,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或销售软件副本,并允许向软件提供者提供软件的人做以上事项,前提是
应在所有副本或主要部分中包含上述版权声明和本许可声明。
软件按“现状”提供,不提供任何保证,无论是明示的、暗示的,还是法定的,包括但不限于适销性、特定目的的适用性和非侵权性保证。在任何情况下,作者或版权所有者不对因软件、软件的使用或其他交易而产生或与之相关的任何索赔、损害或其他责任承担责任。是否通过合同、侵权或其他方式产生。