A trick to get size and apply resize or other effects on your view.
Set your UIWebView delegate and create finishLoad method.
After that, using javascript, get document.height of your view and do what you want.
[code lang=”java” autolinks=”false” collapse=”false” firstline=”1″ gutter=”true” htmlscript=”false” light=”false” padlinenumbers=”false” smarttabs=”true” tabsize=”4″ toolbar=”false”]// in init
_WebView.delegate = YourClass; // probably self
– (void) webViewDidFinishLoad:(UIWebView *)webview
{
int h = [[_WebView stringByEvaluatingJavaScriptFromString:@"document.height"] floatValue];
_WebView.userInteractionEnabled = h > 600;
}[/code]
Remember to use UIWebView delegate in class declaration:
[code lang=”java” autolinks=”false” collapse=”false” firstline=”1″ gutter=”true” htmlscript=”false” light=”false” padlinenumbers=”false” smarttabs=”true” tabsize=”4″ toolbar=”false”]@interface YourClass : UIViewController <uiwebviewdelegate>;
@end[/code]
have fun.
- Unity3D – Snap object in editor grid - 3 January 2021
- Swift – UIView gradient extension - 7 December 2020
- iOS – Data Leakage: App background cache - 16 November 2020