escoz / QuickDialog

QuickDialog - Quick and easy dialog screens for iOS
http://escoz.com/open-source/quickdialog
Other
3.08k stars 637 forks source link

QMultilineElement failing to refresh after text entry (fix suggested) #704

Open jhntr opened 9 years ago

jhntr commented 9 years ago

Hi Eduardo, Sorry I'm not yet hip enough with Github to setup a pull request for this, and thanks so much for the outstanding library.

I've only used QuickDialog on iOS 8, so I'm not sure if this issue is present in earlier versions (or more importantly, if my proposed fix would cause issues on earlier OSs).

When using QMultilineElement, text entry works as expected, but the QMultilineElement cell does not redraw until scrolled off- and back on-screen. In my app, which uses a placeholder value, this results in the placeholder remaining in the cell even after text has been entered.

Suggested fix (on IOS 8, at least): In QMultilineElement.m,

In the implementation of

The current setting for the textController.willDisappearCallback looks like this: textController.willDisappearCallback = ^ { weakSelf.textValue = weakTextController.textView.text; [[tableView cellForElement:weakSelf] setNeedsDisplay]; [tableView deselectRowAtIndexPath:indexPath animated:YES]; };

...which looks like you're trying to avoid exactly the problem I'm seeing. After some experimentation, I think the problem is the call to deselectRowAtIndexPath. The following setting for the willDisappearCallback works as expected on iOS 8:

textController.willDisappearCallback = ^ { weakSelf.textValue = weakTextController.textView.text; };

i.e. the cell refreshes correctly without the call to setNeedsDisplay. My suspicion is that you added this on an earlier OS version that requires it, though.

Thanks again for your work on this project!

-Jared

nithinreddy commented 8 years ago

This helped me, thanks Jared! :)