Comments (3)
我也刚好碰到了这个问题,说下我的解决思路,是通过拦截以下2个代理方法实现的,具体原因在注释里边都写了:
- (void)popupControllerDidPresent:(zhPopupController *)popupController {
// 在view即将出现的时候,主动修改布局来满足底部约束
[self.xxtActionSheet mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.xxtActionSheet.superview);
make.height.mas_equalTo(74*[self.homeworkDemandList count]);
make.bottom.equalTo(self.mas_bottomLayoutGuide);
}];
}
- (void)popupControllerWillDismiss:(zhPopupController *)popupController {
// 由于手动修改约束,会导致关闭动画过高,所以把height尽量缩小
[self.xxtActionSheet mas_updateConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.xxtActionSheet.superview);
make.height.mas_equalTo(1);
make.bottom.equalTo(self.xxtActionSheet.superview);
}];
}
from zhpopupcontroller.
我也刚好碰到了这个问题,说下我的解决思路,是通过拦截以下2个代理方法实现的,具体原因在注释里边都写了:
- (void)popupControllerDidPresent:(zhPopupController *)popupController { // 在view即将出现的时候,主动修改布局来满足底部约束 [self.xxtActionSheet mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(self.xxtActionSheet.superview); make.height.mas_equalTo(74*[self.homeworkDemandList count]); make.bottom.equalTo(self.mas_bottomLayoutGuide); }]; } - (void)popupControllerWillDismiss:(zhPopupController *)popupController { // 由于手动修改约束,会导致关闭动画过高,所以把height尽量缩小 [self.xxtActionSheet mas_updateConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(self.xxtActionSheet.superview); make.height.mas_equalTo(1); make.bottom.equalTo(self.xxtActionSheet.superview); }]; }
我是让他弹出一个带有footer的tableview,然后底部的安全区域是透明的,footer没有贴紧底部,cell确实贴着底部的,这种怎么解决
from zhpopupcontroller.
- 直接导入源码,以获取X系列
safeAreaInsets.bottom
的值,修改zhPopupLayoutTypeBottom
的位置。 - 导入源码 ,声明一个类似
contentInset
属性,同样需要判断是否是zhPopupLayoutTypeBottom
CGFloat safeAreaBottomInset = 0.0f;
if (@available(iOS 11.0, *)) {
safeAreaBottomInset = [UIApplication sharedApplication].keyWindow.safeAreaInsets.bottom;
}
return CGPointMake(point.x, _maskView.bounds.size.height - _popupView.bounds.size.height / 2 -safeAreaBottomInset );
3 . 不需要修改任何源码,新建一个zhPopupController类别,重写finishedCenter方法
如下:
- (CGPoint)finishedCenter {
UIView *_maskView = [self valueForKey:@"_maskView"];
UIView *_popupView = [self valueForKey:@"_popupView"];
NSInteger _layoutType = [[self valueForKey:@"_layoutType"] integerValue];
NSInteger _slideStyle = [[self valueForKey:@"_slideStyle"] integerValue];
CGPoint point = _maskView.center;
switch (_layoutType) {
case zhPopupLayoutTypeTop:
return CGPointMake(point.x,
_popupView.bounds.size.height / 2);
case zhPopupLayoutTypeBottom: //
return CGPointMake(point.x,
_maskView.bounds.size.height - _popupView.bounds.size.height / 2 - 安全域);
case zhPopupLayoutTypeLeft:
return CGPointMake(_popupView.bounds.size.width / 2,
point.y);
case zhPopupLayoutTypeRight:
return CGPointMake(_maskView.bounds.size.width - _popupView.bounds.size.width / 2,
point.y);
default: // zhPopupLayoutTypeCenter
{
if (_slideStyle == zhPopupSlideStyleShrinkInOut1 ||
_slideStyle == zhPopupSlideStyleShrinkInOut2) {
_popupView.transform = CGAffineTransformIdentity;
} else if (_slideStyle == zhPopupSlideStyleFade) {
_maskView.alpha = 1;
}
}
return point;
}
}
from zhpopupcontroller.
Related Issues (20)
- zhPopupLayoutTypeCenter 这个属性只会弹出来一次,第二次就出不来了 HOT 5
- 2次弹出视图,本来控制器能旋转的。不能了为啥
- 点击自定义view的是时候怎么移除zhPopupController
- 弹出的视图内包含UITextView,当UITextView成为第一响应者后,视图上移的位置不准确 HOT 3
- Textfield 弹出键盘 视图位置不正确 HOT 3
- 打断点 zhPopupController init方法都没有调用 咋回事???
- 你好,我想问个问题
- 在已经弹出的视图上再弹出一个视图。
- self.zh_popupController.maskTouched
- App进入后台时候,通过网络请求或者推送触发的弹窗会无法点击 HOT 2
- 大佬,有swift版本的吗 HOT 1
- 弹窗控制器的view代理方法问题
- 先调用dismiss会导致界面出现挡板 遮住无法操作
- 1.0.x的版本标签建议开回来。。。
- 是否可以实现类似淘宝或京东点击滚动条上的筛选条件从滚动条下方显示,而不是从屏幕最上方显示 HOT 1
- 横竖屏切换时的bug
- 横竖屏切换存在BUG HOT 1
- 拖拽手势的判定逻辑需要优化 HOT 1
- 首页界面弹窗调用[[zhPopupController alloc] initWithView:customView size:alert.bounds.size];这个初始化两次会弹窗两次,怎么实现只弹一次
- iOS17适配 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zhpopupcontroller.