Post

Replies

Boosts

Views

Activity

Reply to Disable Scribble in UITextView
Adding a UIScribbleInteraction on a UITextView and returning false for scribbleInteraction(_:shouldBeginAt:) seems to be the official way to do this. To prevent the input widget from showing up you can set UITextView.inputView. If you do not want any view to show up you can specify an empty UIView via setting textView.inputView = UIView().
Oct ’21
Reply to tableView.indexPathForRow(at: to:) returning an index that is off by one.
indexPathForRow uses a CGPoint to determine the corresponding cell indexPath. You are using sender.convert(CGPoint.zero, to: self.tableView) where sender is your button, which corresponds to the top left point of your button in tableView coordinates. Are you sure this point is in the apporpriate cell you want it to be? Also: The CGPoint you use for indexPathForRow needs to be in the contentView of the appropriate cell, so for example a point with negative x value won't work.
Oct ’22
Reply to tableView.indexPathForRow(at: to:) returning an index that is off by one.
As there has been no activity on this thread I post my original comment as a reply as I am pretty sure this is the solution to the problem of the thread starter: indexPathForRow uses a CGPoint to determine the corresponding cell indexPath. The point you are using sender.convert(CGPoint.zero, to: self.tableView) where sender is your button, which corresponds to the top left point of your button in tableView coordinates. This point probably is not in the cell you want it to be. So make sure your button has the appropriate frame or transform the point you use to be in the appropriate cell after transformation (maybe you want to project it onto the cell's contentView frame). Also: The CGPoint you use for indexPathForRow needs to be in the contentView of the appropriate cell, so for example a point with negative x value won't work. Again, projecting the point onto the appropriate cell's contentView frame should help in that case.
Oct ’22