GrowingTextView icon indicating copy to clipboard operation
GrowingTextView copied to clipboard

NSRangeException for multiple GrowingTextView

Open xiaoleichen opened this issue 6 years ago • 1 comments

I have a table view and each cell has a UITextView. After I changed the UITextView to GrowingTextView, I got this exception when I have several cells in the table:

Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 6 beyond bounds [0 .. 5]'
*** First throw call stack:
(0x181be9d04 0x180e38528 0x181b82bd4 0x181ab29a0 0x18b33b774 0x18b33c3b8 0x18b0f1508 0x18b01e304 0x185bd7ec8 0x185bdbfa8 0x185b4aa98 0x185b70eb4 0x185b71cf4 0x181b91848 0x181b8f200 0x181b8f7bc 0x181aaffb8 0x183947f84 0x18b0842f4 0x1010f2678 0x1815d256c)
libc++abi.dylib: terminating with uncaught exception of type NSException

The first throw call stack is not very helpful because it doesn't specify which line of code is causing the issue. But I don't have this exception under the same circumstances if I just use the native UITextView.

xiaoleichen avatar Mar 27 '18 05:03 xiaoleichen

I think it is really not a good idea to add GrowingTextView into a UITableViewCell, it is quite difficult to deal with the state when the cell is reused. If your list doesn't contain too many items, I suggest simply use a UIStackView instead of UITableView.

KennethTsang avatar Sep 10 '18 13:09 KennethTsang