首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CGFloat部门崩溃

CGFloat部门崩溃
EN

Stack Overflow用户
提问于 2015-01-03 21:35:04
回答 2查看 210关注 0票数 0

我有这样的代码:

代码语言:javascript
复制
    CGRect screenRect = [[UIScreen mainScreen] bounds];
    CGFloat screenWidth = screenRect.size.width;
    NSLog([NSString stringWithFormat:@"\n%g pixel \n=======================================",screenWidth]);
    CGFloat imageWidth = [[self.widthArray objectAtIndex:indexPath.row] floatValue];
    NSLog([NSString stringWithFormat:@"\n%f pixel\n=======================================",imageWidth]);
    CGFloat ratio = screenWidth / imageWidth;
    NSLog([NSString stringWithFormat:@"\nratio is %f\n=======================================",ratio]);

screenWidthimageWidth都很好,但是当我尝试登录ratio时,程序就崩溃了,日志显示为(lldb)。我仍然没有找到解决方案。有什么建议吗?

编辑:

前两个日志是

代码语言:javascript
复制
2015-01-03 08:49:00.888 Huckleberry[6554:158359] 
320.000000 pixel 
=======================================
2015-01-03 08:49:00.889 Huckleberry[6554:158359] 
512.000000 pixel
=======================================

然后ratio就是(lldb)

EN

回答 2

Stack Overflow用户

发布于 2015-05-22 21:43:14

如果您在控制台中看到(lldb),那么您很可能遇到了断点。如果你自己没有在那里添加断点,那么你的项目中可能会有一个异常断点,捕获所有未捕获的异常。

尝试点击控制台上方的“播放”按钮,它应该会继续执行(或者至少帮助你了解崩溃是什么)。

票数 1
EN

Stack Overflow用户

发布于 2015-01-03 22:20:13

代码语言:javascript
复制
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
NSLog(@"Screen width = %f pixel", (float) screenWidth);
CGFloat imageWidth = [[self.widthArray objectAtIndex:indexPath.row] floatValue];
NSLog(@"Image width = %f pixel", (float) imageWidth]);
CGFloat ratio = screenWidth / imageWidth;
NSLog(@"ratio is %f", (float) ratio]);
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27755437

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档