UIGuidedView 1.0.0

UIGuidedView 1.0.0

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最新发布2018年9月

Mitchell Malleo维护。



  • 作者:
  • Mitch Malleo

UIGuidedView

描述

UIGuidedView 是一个简单的控件,旨在引导用户通过受控流程。

需求

  • ARC
  • iOS 5.0+
  • xCode 7.0+

安装

  1. UIGuidedView 可以通过将 pod 'UIGuidedView' 添加到您的 podfile 来使用 CocoaPods 安装,或者您可以将 UIGuidedView.h/mUIBezierPath+Circle.h/.m 手动添加到您的项目中。

  2. 创建一个 @property (strong, nonatomic) UIGuidedView *guidedView,设置其 frame,并在您的类中设置引导视图的数据源。唯一需要实现的方法是 - (NSInteger)numberOfNodesForGuidedView:(UIGuidedView *)view;

     //YourViewController.m
     
     - (void)viewDidLoad {
     	self.guidedView.dataSource = self
     }
     
     ... //Other gloriously written code ...
     
     #pragma mark - UIGuidedViewDataSource
     - (NSInteger)numberOfNodesForGuidedView:(UIGuidedView *)view {
    		return 3;
     }
    

使用方法

这就是使它工作所需的一切!如果您需要为每个节点设置标题,还有一个dataSource方法可以做到这一点。

- (NSString *)guidedView:(UIGuidedView *)guidedView titleForNodeAtIndex:(NSInteger)index {

	NSString *title = @"";

    if(index == 0){
        title = @"Choose One";
    }else if (index == 1){
        title = @"Choose Another";
    }else{
        title = @"Confirm";
    }
    
    return title;
}

使用UIGuidedView的代理方法验证用户的输入,无论他们正在进行单个转换还是多个转换。

- (BOOL)guidedView:(UIGuidedView *)guidedView willSingleTransitionFromIndex:(NSInteger)index toIndex:(NSInteger)toIndex inDirection:(UIGuidedViewAnimationDirection)direction;

- (BOOL)guidedView:(UIGuidedView *)guidedView willMultipleTransitionFromIndex:(NSInteger)index toIndex:(NSInteger)toIndex inDirection:(UIGuidedViewAnimationDirection)direction;

- (void)guidedView:(UIGuidedView *)guidedView didSingleTransitionFromIndex:(NSInteger)index toIndex:(NSInteger)toIndex inDirection:(UIGuidedViewAnimationDirection)direction;

- (void)guidedView:(UIGuidedView *)guidedView didMultipleTransitionFromIndex:(NSInteger)index toIndex:(NSInteger)toIndex inDirection:(UIGuidedViewAnimationDirection)direction;

根据需要修改前景和背景线的颜色,以及标题颜色。

@property (strong, nonatomic) UIColor *lineColor;
@property (strong, nonatomic) UIColor *backgroundLineColor;
@property (strong, nonatomic) UIColor *selectedTitleColor;
@property (strong, nonatomic) UIColor *unselectedTitleColor;

自定义引导视图节点是否可触摸。

@property (assign, nonatomic, getter = isTouchable) BOOL touchable;

想在不选中时隐藏节点标题?我为您提供了相应的属性!

@property (assign, nonatomic) BOOL shouldHideTitlesForUnselectedNodes;

示例包括在项目文件中。祝您好运。(

授权

UIGuidedView在MIT授权下可用。有关更多信息,请参阅LICENSE文件。