1 the- .- One the: +:17.167***[930:707] * * * * terminating app due to uncaught exception'Calayerinvalidgeometry', Reason:'calayer position contains nan: ["nan]' 2Call stack at firstThrow: 3 ( 4 0Corefoundation0x3365d64f__exceptionpreprocess + the 5 1LIBOBJC. A.dylib0x33aa0c5dObjc_exception_throw + - 6 2Corefoundation0x3365d491+[nsexception raise:format:arguments:] + the 7 3Corefoundation0X3365D4CB+[nsexception Raise:format:] + the 8 4Quartzcore0x361db61d_zl18calayersetpositionp7calayerrkn2ca4vec2ideeb + $ 9 5Quartzcore0x361db58b-[calayer SetPosition:] + - Ten 6Quartzcore0x361db4d7-[calayer Setframe:] +390 One 7UIKit0x330eb455-[uiview (Geometry) Setframe:] +188 A 8UIKit0x3314854f-[uitableviewcell Setframe:] +98 - 9UIKit0x33147b3b-[uitableview (uitableviewinternal) _createpreparedcellforglobalrow:withindexpath:] +850 - TenUIKit0x3314776b-[uitableview (uitableviewinternal) _createpreparedcellforglobalrow:] + the the OneUIKit0X331400CD-[uitableview (_uitableviewprivate) _updatevisiblecellsnow:] +936 - AUIKit0x3313f27d-[uitableview Layoutsubviews] + $ - -UIKit0X330EB5FB-[uiview (Calayerdelegate) Layoutsublayersoflayer:] + - - -Corefoundation0x335caf03-[nsobject (NSObject) Performselector:withobject:] + A + theQuartzcore0x361dcbb5-[calayer Layoutsublayers] + - - -Quartzcore0x361dc96dCalayerlayoutifneeded +184 + -Quartzcore0x361e21c5_zn2ca7context18commit_transactionepns_11transactione +212 A -Quartzcore0x361e1fd7_zn2ca11transaction6commitev + the at +Quartzcore0x361db055_ZN2CA11TRANSACTION17OBSERVER_CALLBACKEP19__CFRUNLOOPOBSERVERMPV + About - -Corefoundation0x33634a35__cfrunloop_is_calling_out_to_an_observer_callback_function__ + - - +Corefoundation0x33636465__cfrunloopdoobservers +412 - ACorefoundation0x3363775b__cfrunlooprun +854 - atCorefoundation0X335C7EC3Cfrunlooprunspecific + the - -Corefoundation0X335C7DCBCfrunloopruninmode + - in -Graphicsservices0x3413041fGseventrunmodal + the - -Graphicsservices0X341304CBGseventrun + + to -UIKit0x33114d69-[uiapplication _run] +404 + -UIKit0x33112807Uiapplicationmain +670 - inPxiphone0X000028DFMain + - the -Pxiphone0x00002894Start + + * ) $Terminate called after throwing an instance of'NSException
Today, add a function, in iPhone4 reported above exception, and then crash off, IPhone3 on nothing. Think of the solution, so Google. Read a stackoverflow.com article, said that some local code divided by 0 , more in 自定义的UITableView自定义UITableViewCell高度的地方,如:tableView:heightForHeaderInSection:
or tableView:heightForFooterInSection:。
Two delegate methods have no place to be removed. In a closer look at the article, said more in the applicable Sizewithfont method to calculate the Uilabel width of the place. Suddenly, the younger brother has a place to use the Uilabel to display text, need to use the Sizewithfont method to calculate the width of the high, when the nsstring is nil, Sizewithfont will be divided by 0.
Original: http://blog.csdn.net/hanspy/article/details/6538156
PS: When using Sizewithfont to calculate the length of a word in a label in Uitabelview, because the cell of the table view is multiplexed, NSString may be nil when calculating the length of the NSString in the label, which may be divided by 0. will be an error.