1 Star 0 Fork 3

杨码云 / YSPOPGesture

forked from Wan_CodingMan / YSPOPGesture 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Unlicense

ScreenPop

介绍

仿Android左滑返回

输入图片说明

使用说明

  1. PopGestureRecognizerManagerConfiger

/**
 导航控制器
 默认为当前window的导航控制器
 */
@property (nonatomic, strong, nullable) UINavigationController *navigationController;

/**
 拖动时,背景颜色
 默认为0x999999
 */
@property (nonatomic, strong, nullable) UIColor *backGroundColor;

/**
 背景颜色alpha
 默认为0.5
 */
@property (nonatomic, assign) CGFloat backGroundAlpha;

/**
 拖动时展示的图片
 建议填写,否则无图片
 */
@property (nonatomic, copy, nonnull) NSString *returnImageName;

/**
 用于修改拖动时展示的图片的颜色
 默认为不变色即nil
 */
@property (nonatomic, retain, nullable) UIColor *imageColor;


/**
 用于修改拖动时展示返回首页的图片的颜色
 默认为不变色即nil
 */
@property (nonatomic, retain, nullable) UIColor *homeImageColor;

/**
 是否跟随手势位置移动
 默认为YES
 */
@property (nonatomic, assign) BOOL isFollowGesturePosition;

/**
 是否可以返回首页
 默认为YES
 */
@property (nonatomic, assign) BOOL isCanPopToRootViewController;


/**
 返回首页拖动时展示的图片
 isCanPopToRootViewController为YES时,建议填写
 */
@property (nonatomic, copy, nullable) NSString *returnHomeImageName;

/**
 返回首页用时
 默认为1秒
 */
@property (nonatomic, assign) CGFloat returnHomeTime;

/**
 是否执行返回动画
 默认为:YES
 */
@property (nonatomic, assign) BOOL isShowPopAnimated;
  1. PopGestureRecognizerManager

有一个注册方法,注册后会有未完成配置的提示。

/// 单例
+ (instancetype)shareManager;

/// 注册
/// @param config 配置信息
/// @param block 注册回调
- (void)registerManagerWithConfig:(PopGestureRecognizerManagerConfiger * __nullable)config completeBlock:(void(^ __nullable)(BOOL isSuccess, NSString *failString))block;


///调用试例
[[PopGestureRecognizerManager shareManager] registerManagerWithConfig:nil completeBlock:^(BOOL isSuccess, NSString *failString) {
      NSLog(@"%@",failString);
 }];

返回展示的图片为自定义,需要调用

[PopGestureRecognizerManager shareManager].config.retuenImageName = @"xxx";

自行设置

如果允许返回首页, 则需要设置返回首页时展示的图片 左滑后停留一定时间后可返回首页,默认时间为1s 默认为可以返回首页

//设置允许返回首页
[PopGestureRecognizerManager shareManager].config.isCanPopToRootViewController = YES;
//设置返回首页时展示的图片
[PopGestureRecognizerManager shareManager].config.returnHomeImageName = @"xxx";
//设置返回首页停留时间
[PopGestureRecognizerManager shareManager].config.returnHomeTime = 1;
//设置左滑时的背景颜色
[PopGestureRecognizerManager shareManager].config.backGroundColor = xxx;

//设置滑动背景透明度
[PopGestureRecognizerManager shareManager].config.backGroundAlpha = 0.3f;

//设置拖动展示的图片的颜色
//如果未指定,将保持原有的图片颜色
[PopGestureRecognizerManager shareManager].config.imageColor = xxx;
  1. PopGestureRecognizerDelegate

代理有两个可选方法

/// 返回时代理
/// 重写返回按钮时,可实现此方法处理数据
/// @param lastController 上一个controller
/// @param currentController 当前controller
/// @return 是否自动返回上一个controller
- (BOOL)CM_GestureRecognizerPopLastController:(UIViewController *)lastController currentController:(UIViewController *)currentController;

/// 返回首页代理
/// @param currentController 当前controller
/// @return 是否自动返回主页
- (BOOL)CM_GestureRecognizerBackHomeController:(UIViewController *)currentController;

当代理方法返回YES时,则会自动调用POP方法返回上一页面或者首页 返回NO时,需要自行调用返回代码返回 重写返回按钮后,可在代理中添加数据处理代码。

特技

  1. 使用 Readme_XXX.md 来支持不同的语言,例如 Readme_en.md, Readme_zh.md
  2. Gitee 官方博客 blog.gitee.com
  3. 你可以 https://gitee.com/explore 这个地址来了解 Gitee 上的优秀开源项目
  4. GVP 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
  5. Gitee 官方提供的使用手册 https://gitee.com/help
  6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 https://gitee.com/gitee-stars/
This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to <http://unlicense.org>

简介

仿Android左滑返回 展开 收起
Unlicense
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/yangyuefanKEN/YSPOPGesture.git
git@gitee.com:yangyuefanKEN/YSPOPGesture.git
yangyuefanKEN
YSPOPGesture
YSPOPGesture
master

搜索帮助