Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CALayer position contains NaN: [nan -__]

*** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan 81]' // 81 is run time change.

*** First throw call stack:

(
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

My Code:

RangeSlider *slider=  [[RangeSlider alloc] initWithFrame:self.viewSlider.bounds];
[slider addTarget:self action:@selector(slidreDrag:) forControlEvents:UIControlEventValueChanged];           
[self.viewSlider addSubview:slider];
like image 500
Bhadresh Kathiriya Avatar asked Oct 29 '22 17:10

Bhadresh Kathiriya


1 Answers

Solve this issue solution me:

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];

Reason

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

Please set value.
like image 113
Bhadresh Kathiriya Avatar answered Nov 12 '22 22:11

Bhadresh Kathiriya