ios - UITableviewController messes with contentInset of editable UIWebView -
I have got a UITB VUU controller with several sections, it is dynamically created one of the rows in each section It has its accessoryView in the form of a UIWebView. UIWebView is preppulated with HTML so that the text can be edited in it. When UIWebView is taped, scrolls the table view so that the line with UIWebView is above the keyboard; The keyboard appears and UIWebView becomes the first responder. It works fine if the UIWebView table is at the top of the view, then there is no need to scroll the table. Although the bottom line is tapped, the table must be scrolled, then the contents of the scrollView of the content UIWebView are changed.
I uploaded a screenshot to show:
Before selecting UIWebView:
After selecting UIWebView:
After selecting
after UIWebView resigned to the first responder status and dismissed the keyboard, it returns to normal.
I know that this content is embedded property which is being adjusted because I have added the scrollview of the webview to the key value of the "Content Insert" and I can see it by changing it, and Still logging it and confirming that it has changed.
It shows that the problem was not content, this content was built in UIWebView's UIScrollView content here How to fix it:
@interface SomeViewController () @propertyBOOL MonitorEdit Offset change; @end @implementation SomeViewController - (zero) webViewCreationMethod {UIWebView * myWebView = [[UIWebView alloc] init]; // Setup WebView // scrollview view any changes to the contentOffset property [[WebView scrollview] addObserver: Self forKeyPath: @ "contentOffset" option: 0 reference: zero]; [Self Setter content offset change: yes]; } - (void) observeValueForKeyPath: (NSString *) mainpath ofObject: (id) object change: (NSDictionary *) change reference: (zero *) reference {// WebView's contentOffset if (object == [[Self-WebView was changed ] Scrollview] & amp; [main path isEqualToString: @ "contentOffset"] & amp; [self-monitorContentOffsetChanges]) {// stop responding for a change in contentOffset to prevent this method from recurring. [Self setMonitorContentOffsetChanges: NO]; // Forced content back to zero [[[Webview itself] ScrollView] Set Content Offset: Animated CG Pointszero: No]; // In the case of future changes, start monitoring the content changes again [self-setter content offset change: yes]; }} @end This solution is because the scrollview property of UIWebView is required to read only, so that you can not do the UIScrollView subclass and setContentOffset override to perform an operation and force this into UIWebView Are there.
The only thing that I am not sure now is whether the app store is safe or not.
Comments
Post a Comment