Git Product home page Git Product logo

cwlateralslide's Issues

注册手势后首页无响应

你好,我的首页是一个tableViewController,注册手势驱动之后,tableview就无法滚动了,请问是什么原因啊

横竖屏切换的问题

大神,当我使用覆盖在上面左右侧滑出时,横竖屏切换时会有问题,我设置contview的autoresizingMask没有效果,请问我该如何解决呢?

Swift里从抽屉里push的bug

swift里用这个框架,push后不想坐着Demo里那样直接跳到要Push的目标控制器,而是先回到最开始的控制器,再从最开始的控制器push到目标控制器,希望作者能看看

遮盖在上面从左侧划出 push 动画

选择遮盖在上面从左侧划出,然后 Push下一个页面。
虽然侧边栏有个关闭动画,但下一个页面就突然出现了,没有过渡动画,很突兀,望能优化

自动关闭有延迟

LeftViewController点解cell主动关闭,调用方法 [self dismissViewControllerAnimated:YES completion:nil];有延迟的情况,请问需要如何解决

好像不适用此场景”结合UIScrollView使用,滑动到最左侧滑出左侧抽屉,滑动到最右侧滑出右侧抽屉“

目前好像不适用此场景”结合UIScrollView使用,滑动到最左侧滑出左侧抽屉,滑动到最右侧滑出右侧抽屉“,也不知道是不是没用对方法😔

在巨人的肩膀上😜,简单修改了下,ps:新人一枚,若改出问题,请原谅😜
1、在WynterW大神基础上修改了UIScrollView方法
`/**

  • 重写手势,如果是左滑,则禁用掉scrollview自带的
    */
  • (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
    if([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) {
    UIPanGestureRecognizer *pan = (UIPanGestureRecognizer *)gestureRecognizer;
    //NSLog(@"%f -- %f", [pan translationInView:self].x, self.contentOffset.x);
    if([pan translationInView:self].x > 0.0f && self.contentOffset.x == 0.0f) {
    //NSLog(@"左滑");
    return NO;
    }
    if ([pan translationInView:self].x < 0.0f && self.contentSize.width - self.contentOffset.x <= self.bounds.size.width) {
    //NSLog(@"右滑");
    return NO;
    }
    }
    return [super gestureRecognizerShouldBegin:gestureRecognizer];
    }`

2、参照原有注册手势驱动方法之外添加下面的方法
`/**
注册手势驱动方法,侧滑呼出的方向自动确定,一般在viewDidLoad调用,调用之后会添加一个支持侧滑的手势到本控制器

@param openEdgeGesture 是否开启边缘手势,边缘手势的开始范围为距离边缘50以内
@param transitionDirectionAutoBlock 手势过程中执行的操作。传整个点击present的事件即可(看demo的使用)
*/

  • (void)cw_registerShowIntractiveWithEdgeGesture:(BOOL)openEdgeGesture transitionDirectionAutoBlock:(void(^)(CWDrawerTransitionDirection direction))transitionDirectionAutoBlock {

    CWLateralSlideAnimator *animator = [CWLateralSlideAnimator lateralSlideAnimatorWithConfiguration:nil];
    self.transitioningDelegate = animator;

    objc_setAssociatedObject(self, &CWLateralSlideAnimatorKey, animator, OBJC_ASSOCIATION_RETAIN_NONATOMIC);

    CWInteractiveTransition *interactiveShow = [CWInteractiveTransition interactiveWithTransitiontype:CWDrawerTransitiontypeShow];
    [interactiveShow addPanGestureForViewController:self];
    [interactiveShow setValue:@(YES) forKey:@"isAutoDirection"];
    [interactiveShow setValue:@(openEdgeGesture) forKey:@"openEdgeGesture"];
    [interactiveShow setValue:transitionDirectionAutoBlock forKey:@"transitionDirectionAutoBlock"];
    [interactiveShow setValue:@(CWDrawerTransitionDirectionLeft) forKey:@"direction"];

    [animator setValue:interactiveShow forKey:@"interactiveShow"];
    }`

3、修改CWInteractiveTransition.m文件
新增属性
@property (nonatomic, copy) void(^transitionDirectionAutoBlock)(CWDrawerTransitionDirection direction); /* 默认NO */ @property (nonatomic, assign) BOOL isAutoDirection;

修改方法
`- (void)showBeganTranslationX:(CGFloat)x gesture:(UIPanGestureRecognizer *)pan {
//NSLog(@"---->%f", x);
if (self.isAutoDirection == YES) {
if (x >= 0) {
_direction = CWDrawerTransitionDirectionLeft;
} else {
_direction = CWDrawerTransitionDirectionRight;
}
}

if ((x < 0 && _direction == CWDrawerTransitionDirectionLeft) || (x > 0 && _direction == CWDrawerTransitionDirectionRight)) return;

CGFloat locX = [pan locationInView:_weakVC.view].x;
//    NSLog(@"locX: %f",locX);
if (_openEdgeGesture && ((locX > 50 && _direction == CWDrawerTransitionDirectionLeft) || (locX < CGRectGetWidth(_weakVC.view.frame) - 50 && _direction == CWDrawerTransitionDirectionRight))) {
    return;
}
self.interacting = YES;
if (_transitionBlock) {
    _transitionBlock();
}

if (self.isAutoDirection == YES) {
    if (_transitionDirectionAutoBlock) {
        _transitionDirectionAutoBlock(_direction);
    }
}

}`

4、调用
`- (void)viewDidLoad {
[super viewDidLoad];

self.tabBarController.view.backgroundColor = [UIColor whiteColor];

if ([self respondsToSelector:@selector(edgesForExtendedLayout)]) {
    self.edgesForExtendedLayout = UIRectEdgeNone;
}

[self setupNavBarItem];

[self setupScrollView];

// 注册手势驱动
__weak typeof(self)weakSelf = self;
[self cw_registerShowIntractiveWithEdgeGesture:NO transitionDirectionAutoBlock:^(CWDrawerTransitionDirection direction) {
    //NSLog(@"direction = %ld", direction);
    if (direction == CWDrawerTransitionDirectionLeft) {
        [weakSelf leftClick];
    } else if (direction == CWDrawerTransitionDirectionRight) {
        [weakSelf rightClick];
    }
}];

// [self cw_registerShowIntractiveWithEdgeGesture:NO direction:CWDrawerTransitionDirectionLeft transitionBlock:^{
// [weakSelf leftClick];
// }];

// [self cw_registerShowIntractiveWithEdgeGesture:NO direction:CWDrawerTransitionDirectionRight transitionBlock:^{
// [weakSelf rightClick];
// }];

}`

侧滑Push问题

项目根控制器是一个导航栏,当点击侧滑菜单中的事件进行Push时,进而二级控制器,导航栏的标题,按钮会全部消失,楼主有这种问题出现过吗

导航二级页面关闭抽屉手势响应BUG

我是在导航控制器的二级页面加的抽屉效果,抽屉从右边滑出

现在碰到的问题是关闭抽屉的手势和导航栏的pop手势之间有冲突。

就是侧滑时抽屉并没有被关闭,而调用到了导航栏的pop手势,抽屉的根控制器被pop掉了

以下是我的example代码:

import UIKit
import CWLateralSlide

class DrawerViewController: ViewController {
    
    // right item
    @IBOutlet weak var right: UIBarButtonItem!
    
    override func viewDidLoad() {
        super.viewDidLoad()

        cw_registerShowIntractive(withEdgeGesture: true) { [weak self] (direction) in
            guard let ss = self else { return }
            ss.clicked(ss.right)
        }
    }
    // right item clicked
    @IBAction func clicked(_ sender: UIBarButtonItem) {
        let vc = DrawerRightViewController()
        let bg = UIImage.create(with: .green)
        let configure = CWLateralSlideConfiguration(distance: 0, maskAlpha: 0.4, scaleY: 1.0, direction: .right, back: bg)
        cw_showDrawerViewController(vc, animationType: .default, configuration: configure)
    }
    
}

push不了

我push告我This no UINavigationController... 但是我alloc一个UINavigationController再用cw_pushViewController push的话还是push不了,怎么解决?

动画冲突问题

1,首页添加了个跑马灯效果,内部是使用UIView动画或者基础动画实现,
和抽屉的动画冲突了.
因为跑马灯暂停时,是通过修改layer层的属性,
是不是线程堵塞了,
只要触发侧滑手势,跑马灯就消失,松手就有了.
一时不知道怎么解决了.

抽屉出现点击抽屉菜单push或者挑战到Next界面,返回的时候抽屉消失了,怎么让抽屉不消失?

抽屉出现点击抽屉菜单push或者挑战到Next界面,返回的时候抽屉消失了,怎么让抽屉不消失?
而且还有个问题,demo中,用 [self cw_showDrawerViewController:vc animationType:CWDrawerAnimationTypeMask configuration:nil]; present 到LeftVC 之后 再用 [self cw_pushViewController:vc drewerHiddenDuration:0.01]; push到NextVC 后 ,用pop返回时,直接返回到根界面

设导航为根视图时的Push动画

设导航为根视图时(self.window.rootViewController = [[NavigationController alloc] initWithRootViewController:[[ViewController alloc] init]];),侧边栏push到下一页时动画有点闪

侧滑问题

如果我在当前的控制器中添加了左侧的控制器leftVC, 但是没有注册手势, 只是在navigationbar的左侧有个点击事件, 点击时出现leftVC 控制器, [self cw_showDefaultDrawerViewController:leftVC];就像这样, 但是, 当我没有在当前显示leftVC 时, 我从屏幕左侧滑动, 接着, 在当前控制器中, 点击一个cell 时, 出现bug (打开图层的时候可以看到已经present出下一个控制器) , 除非再从屏幕侧滑一下.

bug

present一个navigationcontroller后,再dismiss后,原控制器被抽屉遮盖

关于CWInteractiveTransition里UIGestureRecognizerDelegate判断控制器类的时个写死UITableViewController不太好

#pragma mark - UIGestureRecognizerDelegate
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    
    if ([[self viewController:otherGestureRecognizer.view] isKindOfClass:[UITableViewController class]]) {
        return YES;
    }
    return NO;
}

比如我现在用的是Texture, 控制器类叫ASViewController,这样手势代码就失效了。

左右划出来的界面有问题

第一个右滑出来的左侧边页,在主界面区域往左划(也就是划回去)但还未完全划回去的时候,再往右划,这个时候侧边页两侧出现了白色区域,反复操作白色区域越来越大
第二个左划出来右侧边页,跟第一步基本差不多的步骤,会出现整个界面四周有白色区域,反复操作区域越来越大

点击侧滑上的事件页面跳转不了

大大你好,我用的这个框架遇到这样一个问题
window的rootview为A页面(登录页面)
登录成功后pre到B页面,代码如下
MainViewController * next = [[MainViewController alloc]init];
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:next];
[self presentViewController:nav animated:YES completion:nil];
在B页面上点击显示左侧页面,点击左侧页面的按钮进入下一页报错
Warning: Attempt to present <NextViewController: 0x7ff3a6e17760> on <UINavigationController: 0x7ff3a8035600> whose view is not in the window hierarchy!
这样怎么解决呢

导航条问题

主界面是一个 self.window.rootViewController = [[NavigationController alloc] initWithRootViewController:[[ViewController alloc] init]]; ,在ViewControl 页面 隐藏了 NavigationBar ,点击仿QQ 左侧 划出 选择 push 操作 ,出来的新界面 导航条是白色 而且没有返回按钮 在返回按钮的地方 多点几次 有时能返回到 主界面 有时 回不去 ( 先侧滑一下下 再放开 再点击返回按钮的地方 就能回去) 把tabbar 设置为跟视图的时候 就没有这个问题

侧滑问题

老哥,我centerVC 里面有个scrollView, 导致
[self cw_registerShowIntractiveWithEdgeGesture:YES transitionDirectionAutoBlock:^(CWDrawerTransitionDirection direction) {
//NSLog(@"direction = %ld", direction);
if (direction == CWDrawerTransitionDirectionLeft) { // 左侧滑出
[weakSelf leftItemAction];
}
}];

接收不到响应怎么办

侧栏animationType不同,约束更新也不一致问题

场景:主控制器 Main, 左滑显示控制器 A, animationType = Default, 右滑也显示控制器A, animationType = Mask , A视图有个ImageView竖直居中约束,呈现的效果是,Default动画的左侧A,不居中显示。Mask动画的右侧,则居中显示

发现一个bug

CWInteractiveTransition.m 类中的
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer方法的返回值写反了吧。
当主页面有UITableView时,滑动UITableView会跟滑动手势冲突,导致滑动UITableView的时候,侧边的菜单栏时隐时现。

侧滑卡顿问题

你好,在iPhone 6上,
开启右滑出抽屉,
反复十次,
就会出现卡顿的情况.

但是,点击按钮弹出侧滑很流畅.点击消失也很流畅,但是侧滑消失也卡顿.

主动关闭,tableview点击不响应

接上一个问题,主动开头以为是我的tableview有问题,但是用你的demo也是出现一样的问题

`- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];

// NextViewController *vc = [NextViewController new];
//
// if (indexPath.row == 0 && _drawerType != DrawerDefaultRight && _drawerType != DrawerTypeMaskRight) {
// [self presentViewController:vc animated:YES completion:nil];
//// [self presentViewController:[TestViewController new] animated:YES completion:nil];
//
// }else {
// [self cw_pushViewController:vc];
// }
NSLog(@"🤪");
[self dismissViewControllerAnimated:YES completion:nil];
}`
就改成这样,重复试几次,会出现点击不响应的现象

发现新Bug

重现方式:
1,打开热点,手机顶部会提示个人热点有多少人连接.
2,打开侧滑,
3,连续按两下Home键.
4,出现bug: 侧滑自动消失,返回到主界面,这时主界面有黑色蒙版.

手势冲突问题

老项目首页上使用UIPercentDrivenInteractiveTransition添加了自定义的手势push动画,然后在首页viewdidload上添加

// 注册手势驱动
__weak typeof(self)weakSelf = self;
[self cw_registerShowIntractiveWithEdgeGesture:NO transitionDirectionAutoBlock:^(CWDrawerTransitionDirection direction) {
if (direction == CWDrawerTransitionFromLeft) {
SVLeftViewController *vc = [SVLeftViewController create];
[weakSelf cw_showDrawerViewController:vc animationType:CWDrawerAnimationTypeMask configuration:nil];
}
}];

这样子我原先在首页的Push手势就失效了,请问知道这是什么问题吗

收回左侧栏,在首页弹出一个view,view弹不出来

我想在左侧栏的某个按钮的响应事件中,收回侧边栏,并发一个通知给首页,让首页弹出一个view,[[NSNotificationCenter defaultCenter] postNotificationName:@"showLogin" object:nil];
[self dismissViewControllerAnimated:YES completion:nil]; 这是按钮中的代码,在首页可以收到通知,但是view弹不出来,这是什么情况?

右侧滑出问题

楼主你好!请问我用右侧划出的时候[self cw_presentViewController:vc]present到下个界面后,dismiss不能回到侧滑的那个界面而是直接回到未侧滑之前的那个界面。而我使用[self presentViewController:vc animated:YES completion:nil];这种方式present,dismiss倒是可以回到侧滑的那个界面,但是此时这个侧滑又有问题。(阴影部分出错)希望您可以回到我一下!

cell 侧滑不起作用了

我在界面加了tableview 添加了cell侧滑 注册了侧边栏侧滑手势 cell 侧滑就不起作用了

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.