이 코드가 있습니다CGFloat 분할 충돌
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]);
screenWidth
및 imageWidth
가 완벽하게 정상적으로입니다,하지만 난 ratio
를 기록 할 때 프로그램은 충돌 및 로그 (lldb)
을 말한다. 아직 솔루션을 찾지 못했습니다. 모든 Sugestions?
편집 :
처음 두 로그
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
=======================================
이며, 가장 가능성이 히트 한 콘솔에서 (lldb)
가 표시되면 다음 ratio
그냥 (lldb)
1. 값은 무엇입니까? 2. NSLog()를 연구하면'stringWithFormat'을 사용할 필요가 없습니다. 예 :'NSLog (@ "\ n % g 픽셀 \ n ================================ === ", screenWidth);' – zaph
NSLog()를 연구하면 stringWithFormat을 사용할 필요가 없습니다. 예 :'NSLog (@ "\ n % g 픽셀 \ n ================================ === ", screenWidth);'. 더 나아가'NSLog()'의 형식 문자열은 리터럴이어야하며, Xcode는 이것에 대해서도 경고합니다. – zaph
32 비트 플랫폼의 경우 'CGFLoat'은'float '로 정의되고, 64 비트 플랫폼의 경우'CGFLoat'는 'double'으로 정의됩니다. – zaph