大佬 发现了一个适配问题能帮忙看一下么
MrJoexx opened this issue · comments
- (void)setCm_x:(CGFloat)cm_x{
CGRect frame = self.frame;
frame.origin.x = cm_x;
self.frame = frame;//崩在了这一行,frame CGRect (origin = (x = NaN, y = 52.620689655172413), size = (width = 1.7976931348623157E+308, height = 2))
}
Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan 53.6207]'
设备:iphone6s plus 系统版本:9.3.5
这台手机上会有问题 iOS12、13的都没问题
CMPageContentView.m这个文件里的这个方法
-
(void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (_isAniming || self.config.cm_childControllers.count == 0) return;if (self.cm_delegate) {
CGFloat progress = scrollView.contentOffset.x / self.cm_width - floor(scrollView.contentOffset.x / self.cm_width);//应该是这一行的计算出错了 NSUInteger leftIndex = floor(scrollView.contentOffset.x / self.cm_width); NSUInteger rightIndex = leftIndex + 1; [self.cm_delegate cm_pageContentViewDidScrollProgress:progress LeftIndex:leftIndex RightIndex:rightIndex];
}
}
- (void)setCm_x:(CGFloat)cm_x{
CGRect frame = self.frame;
frame.origin.x = cm_x;
self.frame = frame;//崩在了这一行,frame CGRect (origin = (x = NaN, y = 52.620689655172413), size = (width = 1.7976931348623157E+308, height = 2))
}Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan 53.6207]'
设备:iphone6s plus 系统版本:9.3.5
这台手机上会有问题 iOS12、13的都没问题CMPageContentView.m这个文件里的这个方法
(void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (_isAniming || self.config.cm_childControllers.count == 0) return;
if (self.cm_delegate) {CGFloat progress = scrollView.contentOffset.x / self.cm_width - floor(scrollView.contentOffset.x / self.cm_width);//应该是这一行的计算出错了 NSUInteger leftIndex = floor(scrollView.contentOffset.x / self.cm_width); NSUInteger rightIndex = leftIndex + 1; [self.cm_delegate cm_pageContentViewDidScrollProgress:progress LeftIndex:leftIndex RightIndex:rightIndex];
}
}
从报错上来看,是除以0 的问题,手头没有ios9的真机,我先用9的模拟器跑一下看看
对 应该是self.cm_width这个为0了
对 应该是self.cm_width这个为0了
昨天尝试安装了个9.3的模拟器没装成功。
手头没有iOS 9系列的测试机,你尝试一下看看能不能把报错的位置处理一下,如果可以处理的话,可以提个contribution,谢谢了。
我现在托朋友买个9.3的测试机
哈哈哈 其实我也想给解决了 但是我这边的时间实在太紧了 我直接把最低版本调到iOS10了 我要是有空的话就帮你看看
我建议你这边可以建个QQ群 以后有什么问题大家都可以直接在群里交流,用你的sdk的名字命名
哈哈哈 其实我也想给解决了 但是我这边的时间实在太紧了 我直接把最低版本调到iOS10了 我要是有空的话就帮你看看
你这个解决方案,很强势,哈哈哈哈哈哈
已经托朋友找9.3的手机了,找到后,我赶紧解决一下
最后,非常感谢你建群的建议
我建议你这边可以建个QQ群 以后有什么问题大家都可以直接在群里交流,用你的sdk的名字命名
老哥,今天我求购的9.3.2系统的手机终于到了,iPhone SE,我跑了一下我的demo,没发现崩溃的问题,能贴一下你的代码和复现步骤么?
你给我个qq吧 我加你 咱俩qq说
757926310你加我吧
哥们 那个问题你这边有空加我一下qq?我用我这边的手机调试一下你看看?
CMPageTitleView *pageView = [[CMPageTitleView alloc] initWithFrame:CGRectMake(0, 0, DEVICE_WIDTH, autoScale(88))];
pageView.delegate = self;
CMPageTitleConfig *config = [CMPageTitleConfig defaultConfig];
config.cm_childControllers = childControllers; //必传参数
config.cm_gradientStyle = CMTitleColorGradientStyle_RGB;
config.cm_switchMode = CMPageTitleSwitchMode_Underline | CMPageTitleSwitchMode_Scale;
config.cm_contentMode = CMPageTitleContentMode_Center;
config.cm_additionalMode = CMPageTitleAdditionalMode_Seperateline;
config.cm_seperaterLineColor = UIColorFromRGB(0xeeeeee);
config.cm_font = [UIFont fontWithName:@"Helvetica-Bold" size:17];
config.cm_selectedFont = [UIFont fontWithName:@"Helvetica-Bold" size:18];
config.cm_normalColor = UIColorFromRGB(0x999999);
config.cm_selectedColor = [UIColor blackColor];
config.cm_underlineColor = [UIColor blackColor];
config.cm_titleHeight = autoScale(88);
if (self.findContentType == FindFinanceType) {
config.cm_defaultIndex = 0;
}else if (self.findContentType == FindPositionType){
config.cm_defaultIndex = 1;
}else{
config.cm_defaultIndex = 2;
}
pageView.cm_config = config;
[self.view addSubview:pageView];
[pageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.view);
make.right.mas_equalTo(self.view);
make.top.mas_equalTo(self.view).with.offset(JPNavibarH - autoScale(88));
make.height.mas_equalTo(DEVICE_HEIGHT);
}];
NSArray *gestureArray = self.navigationController.view.gestureRecognizers;
for (UIGestureRecognizer *gestureRecognizer in gestureArray) {
if ([gestureRecognizer isKindOfClass:[UIScreenEdgePanGestureRecognizer class]]) {
[pageView.contentView.panGestureRecognizer requireGestureRecognizerToFail:gestureRecognizer];
}
}
这些是我的代码 你看看有没有问题,我觉得还是手机的问题 我的手机是iOS9的iPhone6plus
哥们 那个问题你这边有空加我一下qq?我用我这边的手机调试一下你看看?
那天加你来着,但是验证问题,一直不对。qaq
要不你加我吧,583538990