2016-11-12 89 views
0

***由於未捕獲異常'CALayerInvalidGeometry'導致應用終止,原因:'CALayer位置包含NaN:[nan 81]'// 81是運行時間改變。CALayer位置包含NaN:[nan -__]

***第一擲調用堆棧:

(
0 CoreFoundation      0x000000011041a34b __exceptionPreprocess + 171 
1 libobjc.A.dylib      0x000000010f84021e objc_exception_throw + 48 
2 CoreFoundation      0x0000000110483265 +[NSException raise:format:] + 197 
3 QuartzCore       0x000000010c4842f2 _ZN2CA5Layer12set_positionERKNS_4Vec2IdEEb + 152 
4 QuartzCore       0x000000010c484467 -[CALayer setPosition:] + 44 
5 UIKit        0x000000010c7e18d2 -[UIView setCenter:] + 233 
6 Hi2Buy        0x000000010bf517e1 -[RangeSlider layoutSubviews] + 193 
7 UIKit        0x000000010c807344 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1237 
8 QuartzCore       0x000000010c48dcdc -[CALayer layoutSublayers] + 146 
9 QuartzCore       0x000000010c4817a0 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366 
10 QuartzCore       0x000000010c48161e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24 
11 QuartzCore       0x000000010c40f62c _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280 
12 QuartzCore       0x000000010c43c713 _ZN2CA11Transaction6commitEv + 475 
13 QuartzCore       0x000000010c43d083 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 113 
14 CoreFoundation      0x00000001103bee17 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23 
15 CoreFoundation      0x00000001103bed87 __CFRunLoopDoObservers + 391 
16 CoreFoundation      0x00000001103a3b9e __CFRunLoopRun + 1198 
17 CoreFoundation      0x00000001103a3494 CFRunLoopRunSpecific + 420 
18 GraphicsServices     0x0000000112daba6f GSEventRunModal + 161 
19 UIKit        0x000000010c742f34 UIApplicationMain + 159 
20 Hi2Buy        0x000000010bfa3ddf main + 111 
21 libdyld.dylib      0x0000000111d7068d start + 1 
22 ???         0x0000000000000001 0x0 + 1 
) 

libc++abi.dylib: terminating with uncaught exception of type NSException 

我的代碼:

RangeSlider *slider= [[RangeSlider alloc] initWithFrame:self.viewSlider.bounds]; 
[slider addTarget:self action:@selector(slidreDrag:) forControlEvents:UIControlEventValueChanged];   
[self.viewSlider addSubview:slider]; 
+0

也許,在你的自定義控件RangeSlider問題,仔細一看佈局子視圖方法 –

+1

如果您提供從'RangeSlider'代碼代碼,這將是更多的機會,我們可以發現問題 – alexburtnik

回答

0

解決這個問題的解決方案我:

RangeSlider *slider= [[RangeSlider alloc] initWithFrame:self.viewSlider.bounds]; 
slider.minimumValue = [minValue floatValue]; 
slider.selectedMinimumValue = [minValue floatValue]; 
slider.maximumValue = [maxValue floatValue]; 
slider.selectedMaximumValue = [maxValue floatValue]; 
slider.minimumRange = 2; 
[slider addTarget:self action:@selector(slidreDrag:) forControlEvents:UIControlEventValueChanged];   
[self.viewSlider addSubview:slider]; 

原因

you are doesn't set value of minimum, maximum that this value by default select NaN value this type error occur. 

Please set value.