VXWalkthroughViewController-Swift 1.1.24

VXWalkthroughViewController-Swift 1.1.24

Graham Lancashire维护。



  • Graham Lancashire

VXWalkthroughViewController

VXWalkthroughViewController 是一种简单的方式来为您的应用程序添加引导介绍。按步骤向用户展示应用程序的主要功能。您可以将文本、图片甚至简单的 html 包括进引导教程中。

VXWalkthroughViewController

VXWalkthroughViewController-Swift 特性

  • 易于集成
  • 使用现有的本地化配置
  • 支持图片
  • 支持 iPhone 和 iPad

安装

CocoaPods

如果您想使用 CocoaPods 来使用 VXWalkthroughViewController,请在您的 podfile 中添加:pod 'VXWalkthroughViewController-Swift', :head

使用

(请参考 /Demo 中的示例 Xcode 项目的使用方法)

向您的 Localizable.strings 文件中添加一些步骤,以便可以使用 NSLocalizedString 找到它们。您可以添加任意多的步骤,但是从 0 开始,并确保它们没有步骤。如果您想添加图片,可以使用预定的名称如 walkthrough_0.pngwalkthrough_1.png 等,将它们添加到项目中。

"walkthrough_0" = "See No Evil";
"walkthrough_1" = "Hear No Evil";
"walkthrough_2" = "Speak No Evil";

检查是否需要在 viewDidload 中显示引导

if(![VXWalkthroughViewController walkthroughShown]) {
	// this is to avoid timing issues
	dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
		// show the walkthrough
		[self showWalkthrough];
	});
}

这是使用便利方法 VXWalkthroughModalViewController 的最简单方式

- (void)showWalkthrough{
	UIColor *backgroundColor = [UIColor colorWithRed:167.0f/255.0f green:131.0f/255.0f blue:82.0f/255.0f alpha:1.0f];

	// create the walkthough controller
	VXWalkthroughViewController* walkthrough = [VXWalkthroughViewController initWithDelegate:self withBackgroundColor:backgroundColor];

	// show it
	[self presentViewController:walkthrough animated:YES completion:nil];
}
-(void)walkthroughCloseButtonPressed:(id)sender{
	// delegate for handling close button
	[self dismissViewControllerAnimated:YES completion:nil];
}

发布说明

1.0.17

针对 iOS 13 的微调修复

1.0.16

添加了特定任务的页面控制器(例如,登录、注册、操作等),在登录页面视图中添加了扫描二维码的选项

1.0.15

针对 iOS 11 的修复

1.0.12

更好地处理启动时的不同方向,一旦开始锁定旋转以防止显示问题,在 XCode 7.2.1 下重新编译并修复了警告

1.0.11

实现了控制和动态修改教程屏幕群体的选项。示例显示了启动的自动群体和更改图像(更适合)

	[walkthrough populate];
	
	NSString *key = @"walkthrough_1";
	NSMutableDictionary* item = [[walkthrough.items valueForKey:key] mutableCopy];
	
	if(item) {
		NSString* imageName = [[self.categories firstObject] imageName];
		if(imageName) {
			[item setValue:imageName forKey:@"image"];
			[walkthrough.items setObject:item forKey:key];
		}
	}

1.0.10

实现了 Jay Lyerly 的建议,添加了使用全屏图像的选项

	walkthrough.roundImages = NO;

鸣谢

VXWalkthroughViewController 基于 Yari D'areglia 的 BWWalkthrough 和 Sam Vermettes 的 SVWebViewController。VXWalkthroughViewController 由 Swift Management AG项目贡献者 提供。如果您有功能建议或错误报告,请随时通过发送 pull requests 或通过 创建新问题 帮助。如果您在项目中使用 VXWalkthroughViewController,则总是会受到赞赏的归属。