Skip to content

Instantly share code, notes, and snippets.

@AlanQuatermain
Created April 23, 2009 03:24
Show Gist options
  • Save AlanQuatermain/100277 to your computer and use it in GitHub Desktop.
Save AlanQuatermain/100277 to your computer and use it in GitHub Desktop.
How to make a UIWebView in a table cell fill the ugly grey bit with rendered data
@interface UIWebView (WebViewManualRedrawSupport)
- (id) _documentView;
@end
@interface NSObject (WebViewManualRedrawSupport)
- (id) _webCoreNeedsDisplay;
@end
@implementation MyTableCellContainingAWebView (GetRidOfUglyGreyBlock)
- (void) setWebContentNeedsDisplay
{
id docView = [_myWebView _documentView];
if ( [docView respondsToSelector: @selector(_webCoreNeedsDisplay)] )
[docView _webCoreNeedsDisplay];
}
@end
@implementation MyTableViewController (WebViewRedrawingSupport)
- (void) scrollViewDidEndDragging: (UIScrollView *) scrollView
willDecelerate: (BOOL) willDecelerate
{
[contentViewerCell setWebViewNeedsDisplay];
if ( [[self superclass] instancesRespondToSelector: _cmd] )
{
[super scrollViewDidEndDragging: scrollView
willDecelerate: willDecelerate];
}
}
- (void) scrollViewDidEndDecelerating: (UIScrollView *) scrollView
{
[contentViewerCell setWebViewNeedsDisplay];
if ( [[self superclass] instancesRespondToSelector: _cmd] )
[super scrollViewDidEndDecelerating: scrollView];
}
@end
@jonsterling
Copy link

Is there a way to do this using only documented methods?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment