MFWalkthrough 0.0.2

MFWalkthrough 0.0.2

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布时间最后发布2014年12月

Mark Fayngersh 维护。



 
依赖
KVOController~> 1.0
FRDLivelyButton~> 1.1.2
 

博客文章

MFWalkthrough:iOS 的容器视图控制器

安装

演示

您可以在 Example/WalkthroughDemo 中找到示例项目。

Demo

使用

显示包含 3 个视图控制器的引导流程

  • MFWalkthroughDataSource - 用于确定要观察哪个属性以启用过渡
  • MFWalkthroughDelegate - 对各种过渡和状态做出响应
#import <MFWalkthrough/MFWalkthroughViewController.h>

@interface ViewController : UIViewController <MFWalkthroughDataSource, MFWalkthroughDelegate>

在实现中,

// Initialize your view controllers
UIViewController *firstController;
UIViewController *secondController;
UIViewController *lastController;

// Create the MFWalkthroughViewController instance
MFWalkthroughViewController *walkthroughController =
      [[MFWalkthroughViewController alloc]
          initWithViewControllers:@[ firstController, secondController, lastController ]];

// Present the walkthrough controller
[self.navigationController pushViewController:walkthroughController
                                       animated:YES];

必需的数据源方法

- (NSString *)walkthroughViewController:(MFWalkthroughViewController *)walkthroughViewController enableContinuePropertyForViewController:(UIViewController *)viewController {
  return @"somePropertyThatDeterminesIfContinueIsEnabled";
}

必需的代理方法

- (void)walkthroughViewController:(MFWalkthroughViewController *)walkthroughViewController willGoBackFromFirstViewController:(UIViewController *)firstViewController {
  NSLog(@"I'm at the very beginning!");
}

- (void)walkthroughViewController:(MFWalkthroughViewController *)walkthroughViewController willContinueFromLastViewController:(UIViewController *)lastViewController {
  NSLog(@"I'm at the very end!");
}

以下代理方法是可选的

  • - (void)walkthroughViewController:couldNotContinueFromViewController
  • - (void)walkthroughViewController:willContinueFromViewController:toViewController
  • - (void)walkthroughViewController:willGoBackFromViewController:toViewController

请参阅源文档以获取更多详细信息

自定义

MFWalkthrough 被设计成与 UINavigationController 一起使用,简化了视图中根据某些中间状态的切换条件。

FRDLivelyButton 用于绘制导航按钮。您可以通过以下 MFWalkthroughViewController 属性来自定义按钮颜色和线条宽度

  • (UIColor *)navigationButtonColor - 默认为 navigationBar.tintColor
  • (CGFloat)navigationButtonLineWidth - 默认为 3.0f

测试

要运行单元测试

$ cd Example
$ make install
$ make ci

作者

Mark Fayngersh, [email protected]

许可证

MFWalkthrough 可在 MIT 许可证下使用。有关更多信息,请参阅 LICENSE 文件。