Giter Site home page Giter Site logo

heathwang / hwpanmodal Goto Github PK

View Code? Open in Web Editor NEW
1.1K 19.0 194.0 17.26 MB

HWPanModal presents controller from bottom and drag to dismiss, high customize. iOS13 default modalPresentationStyle. 任意形式的底部弹框动画;头条、知乎、抖音弹出评论效果;地图浮层,iOS13 present默认模态效果。

License: MIT License

Objective-C 75.70% Ruby 0.73% Swift 23.49% Shell 0.09%
ios-ui panmodal gesture-control presenter sheet animation ios13 modalpresentationstyle card-animation popup

hwpanmodal's Introduction

Hey there 😁

My name is HeathWang, an iOS software engineer.

  • 💻 I’m currently learning Swift, Python.
  • 💭 Discuss about iOS development with me.
  • ✉️ Contact me: click here
  • 🎯 Coding, Reading.

trophy

HeathWang's Github Stats HeathWang's Top langs

hwpanmodal's People

Contributors

gandjafuzz avatar heathwang avatar mlch911 avatar yangjie2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hwpanmodal's Issues

tableView不可滑动

代理输出如下
scrollViewDidScroll:] 0.000000
scrollViewDidScroll:] 11.000000
scrollViewDidScroll:] 0.000000
scrollViewDidScroll:] 12.500000
scrollViewDidScroll:] 0.000000
scrollViewDidScroll:] 12.500000
scrollViewDidScroll:] 0.000000
scrollViewDidScroll:] 15.000000
scrollViewDidScroll:] 0.000000
scrollViewDidScroll:] 16.500000
scrollViewDidScroll:] 0.000000
scrollViewDidScroll:] 17.000000
scrollViewDidScroll:] 0.000000
可能什么原因造成的?

弹不出来

Describe the bug
使用Pod 导入 Pod Version:HWPanModal (0.6.7)
具体描述:在项目中使用弹不出来、但已经打印弹出完成。界面上没东西。。。

我的使用方法:
#import <HWPanModal/HWPanModal.h>
然后

[self presentPanModal:[CMDiscoveryFilterViewController new] completion:^{
        NSLog(@"弹出完成");
    }];
    

控制器代码:

#import "CMDiscoveryFilterViewController.h"
#import <HWPanModal/HWPanModal.h>

@interface CMDiscoveryFilterViewController ()<HWPanModalPresentable>

@end

@implementation CMDiscoveryFilterViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor colorWithRed:0.000 green:0.989 blue:0.935 alpha:1.00];
}

#pragma mark - HWPanModalPresentable

- (PanModalHeight)shortFormHeight {
    if ([self isLandScape]) {
        return [self longFormHeight];
    }
    return PanModalHeightMake(PanModalHeightTypeContent, 200.00001);
}


// 当转屏且为横屏时,为全屏幕模式。
- (CGFloat)topOffset {
    if ([self isLandScape]) {
        return 0;
    } else {
        return 40;
    }
}

- (BOOL)anchorModalToLongForm {
    return NO;
}

//- (HWPanModalShadow)contentShadow {
//    return PanModalShadowMake([UIColor yellowColor], 10, CGSizeMake(0, 2), 1);
//}

- (UIViewAnimationOptions)transitionAnimationOptions {
    return UIViewAnimationOptionCurveLinear;
}

- (BOOL)isLandScape {
    if ([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeRight ||
        [UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeLeft) {
        return YES;
    }
    return NO;
}

#ifdef DEBUG

- (void)dealloc {
    NSLog(@"%s", __PRETTY_FUNCTION__);
}

#endif

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end

反馈群加不进去提示已经过期、麻烦加个微信方便反馈、我的微信号:mokejie_com

关于contentInset的问题

- (void)configureScrollViewInsets {

	// when scrolling, return
	if ([self.presentable panScrollable] && ![self.presentable panScrollable].isScrolling) {
		UIScrollView *scrollView = [self.presentable panScrollable];
		// 禁用scrollView indicator除非用户开始滑动scrollView
		scrollView.showsVerticalScrollIndicator = NO;
		scrollView.scrollEnabled = [self.presentable isPanScrollEnabled];
		scrollView.scrollIndicatorInsets = [self.presentable scrollIndicatorInsets];

		UIEdgeInsets insets1 = scrollView.contentInset;
		insets1.bottom = self.presentedViewController.bottomLayoutGuide.length;
		scrollView.contentInset = insets1;

        if (@available(iOS 11.0, *)) {
            scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
        } else {
            // Fallback on earlier versions
        }
	}
}

初始化时, 发现您更改了contentInset的值, 在适配iPhone X系列的手机时, 我设置了tableView的contentInset.bottom 为kSafeAreaBottom = 34, 但是这个方法给我改成了 0

vc里面添加tableview,使用协议的panscrolable返回,但是不能滑动,这是怎么回事呢

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

可以加个在顶部设置阴影的属性吗?

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

遇到了2个问题

问题1:聊天界面创建几条消息cell的时候,tableview scrollToRowAtIndexPath无法进行滑动
问题2:设置了panScrollable之后,拖拽panScrollable区域以外无法收起弹窗。如:头部标题View

tableView.contentInset问题

设置了tableView.contentInset.top = 100
在向下拖拽的时候会contentInset.top会=0,导致界面异常
同时以下2个方法都试过,都不能解决问题

  • (UIEdgeInsets)scrollIndicatorInsets;
    {
    return UIEdgeInsetsMake(100, 0, 0, 0);
    }
  • (CGFloat)topOffset;
    {
    return 100;
    }

edge返回手势冲突

0.3.6版本,当present一个uinavigationcontroller, 如何处理hwpancontainerView的edge返回手势与自己的uinavigationcontroller的全屏返回手势的冲突??

使用HWPanModalContentView的时候怎么关闭ViewController的侧滑返回

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

集成极光统计导致crash

image
image

发生在统计开始时
| JIGUANG | D - [JIGUANGRequestSession] setViewStart name CXYStoreDetails_VC time 2020-04-21-10:14:23

崩溃处打印
(lldb) po self
warning: could not execute support code to read Objective-C class data in the process. This may reduce the quality of type information available.
0x0000000117f459b0

我们App新增的需求添加极光统计, 未添加时一切正常, 商品详情和店铺都有分享
操作顺序 打开店铺分享 -> 关闭店铺分享 -> 打开商品分享 -> crash
操作顺序 打开商品分享 -> 关闭商品分享 -> 打开店铺分享 -> crash

HWPanModalContentView 弹出 collectionView 做横向滚动时滑动有问题

Describe the bug
1、已在 reloadData 之后调用了 hw_panModalSetNeedsLayoutUpdate
2、竖向滚动没有问题
3、设置为横向后 flowLayout 的 inset 设置不准,右滑会让 collectionView 归位到 0,左滑很难触发

我注意到,滑动触发的方法 HWPanModalPresentableHandler.m

  • (void)didPanOnScrollViewChanged:(NSDictionary<NSKeyValueChangeKey, id> *)change;
    里面只判断了 scrollView.contentOffset.y > 0

另外,正常竖向滚动触发 trackScrolling
而横向滚动 总是触发 haltScrolling

导航栏问题

Describe the bug
如果前面vc隐藏导航栏 模态到另一个vc 然后返回 会发现导航栏会跳动

影响iOS13 present modalPresentationStyle

具体bugs:
在iOS13中 present 带Navigation的控制器, 设置 nav.modalPresentationStyle = .fullScreen 无效, present的效果依旧是iOS13中的pageSheet效果
定位问题到 UINavigationController+HWPanModal.m 文件中
[self hw_swizzleInstanceMethod:@selector(pushViewController:animated:) with:@selector(hw_pushViewController:animated:)];

如果同时弹出两个视图,有没有好的解决方案?

Attempt to present <HWAlertViewController: 0x1049330a0> on <HWViewController: 0x104c0bfb0> which is already presenting (null)
你的demo里 alert , 我尝试连续弹两个, 会出现上述提示, 能不能处理一下两个alertView 或者presentVC 同时存在, 不知有什么好点的解决方案没

如何停止用户拖拽手势滑动

/**

  • 是否允许pan scroll view
  • 默认为YES
    */
  • (BOOL)isPanScrollEnabled;

该方法好像不生效。
目前有个界面不希望用户去滑动卡片。但是允许卡片外滑动收起。

present 带导航的bug

Group-Nav-知乎评论能复现bug
操作流程

  1. 点击 App Demo,
  2. 点击 Group-Nav-知乎评论
  3. 下滑关闭界面, 可见界面消失, 然后离开上滑界面, 原界面可以继续弹出。

presentPanModal: modal 一个导航控制器问题

你好,我通过presentPanModal:方法,modal 一个导航控制器,然后在viewWillAppear:的时候隐藏导航栏,拖拽关闭的时候不能 dismiss 整个控制器,并且设置 shortFormHeight 无效,一出来就直接到顶部了。

Dismiss view controller when selecting table view cell

Hi all,
Congratulations for this amazing library!

I'm trying to integrate it in one of my personal projects but I'm having a small issue. Right now I'm presenting a view controller with a table view using the library (just like in your example project). I want to dismiss this view controller when selecting a table view cell, the view controller dismisses but for some reason this takes too much time (view controller dismisses approximately 5 seconds after selecting the cell and calling -dismissViewControllerAnimated:completion method). I did a quick test, I added a button to dismiss the view controller and it worked flawlessly, the only issue is on the table view. Also I think is important to state that I do not have any complex code running that could cause a slow performance. Am I doing something wrong? Do I need to set a more advance configuration?

Thanks!

HWPanModal在iOS13以下会对TabBarController的导航控制器强引用

发现在iOS13以上,导入HWPanModal 进行RootController切换,Tab的导航控制器能够正常释放,但在iOS13以下,会对导航控制器强引用
image
image
发现是presentationController 这个类导致的循环引用问题
UIViewController.presentationController.delegate 的 delegate 在 iOS 13 之前的声明是 strong 的,导致 delegate 的两端相互强引用无法正常释放,苹果在 iOS 13 悄咪咪地改为了 weak,但对于 iOS 12 及之前的版本这个内存泄漏问题则会一直存在

Content misplacement on iPhone X when PanModalHeight is set to intrinsic

Describe the bug
If I set the bottom content constraint to safe area (rather than superview, in that case everything works fine) and return PanModalHeight(type: .intrinsic, height: 0) for longFormHeight, I am able to drag the content up higher, leaving the gap at the bottom (which seems to be equal to safeAreaInsets.bottom).

To Reproduce

  1. Patch ShoppingCartViewController with these changes:
        bgView.snp.makeConstraints { (maker) in
//            maker.edges.equalTo(view)
            maker.leading.equalToSuperview()
            maker.trailing.equalToSuperview()
            maker.top.equalToSuperview()
            if #available(iOS 11.0, *) {
                maker.bottom.equalTo(self.view.safeAreaLayoutGuide)
            } else {
                maker.bottom.equalToSuperview()
            }
        }

...

extension ShoppingCartViewController {

    override func longFormHeight() -> PanModalHeight {
        return PanModalHeight(type: .intrinsic, height: 0)
    }
  1. Present the viewcontroller
  2. Drag it higher

Expected behavior
Just like in .content mode, I expect the viewcontroller will not move higher that it's intrinsic content size.

Screenshots
Simulator Screen Shot - iPhone X - 2019-11-24 at 23 44 18

Screencast

ezgif-1-bcdee9e60ccd

longFormHeight/shortFormHeight

  • (PanModalHeight)longFormHeight {
    CGFloat h = (FBXSafeAreaBottom()+kWINDOW_H/5*3);
    PanModalHeight height = PanModalHeightMake(PanModalHeightTypeContent, h);
    return height;
    }

当 h 为 float 类型时,会出现滑动 contentView 就 dismiss 的问题
将 h 类型改为 integer 时,该问题消失

我如何自己控制键盘的弹出?

之前的版本我是导入了 #import "UIViewController+LayoutHelper.h" 文件,
获取presentedVc 自己控制的, 我看现在没办法导入这个文件, 还有什么方式可以自己处理吗?

UIDatePicker 使用问题???

使用UITableView 滑动没有问题。
但是使用UIDatePicker,弹出和显示都没有问题;向下滑动时间选择时,会自动下滑关闭窗口,请问怎么解决???

override func longFormHeight() -> PanModalHeight {
    return PanModalHeight(type: .contentIgnoringSafeArea, height: 380.0)
}

override func anchorModalToLongForm() -> Bool {
    return true
}

override func panScrollable() -> UIScrollView? {
return nil
}

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.