-
-
Save choonkeat/d6589584944685909ae5 to your computer and use it in GitHub Desktop.
Alternative for https://gist.github.com/834907
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html>body.pphone { font-size:12px; width: 980px; } | |
html>body.lphone { font-size:18px; width: 1470px; } | |
html>body.ppad { font-size:12px; width: 768px; } | |
html>body.lpad { font-size:15.99999996px; width: 1024px; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<meta name="viewport" content="width=VIEWPORTWIDTH,maximum-scale=4.5;" id="viewport"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSArray *parts = [htmlstring componentsSeparatedByString:@"VIEWPORTWIDTH"] | |
NSString *html = [parts componentsJoinedByString:((UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) ? @"768" : @"980")]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { | |
switch (toInterfaceOrientation) { | |
case UIInterfaceOrientationPortraitUpsideDown: | |
case UIInterfaceOrientationPortrait: | |
if ((UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)) { | |
[webview stringByEvaluatingJavaScriptFromString:@"document.body.className = 'ppad'"]; | |
} else { | |
[webview stringByEvaluatingJavaScriptFromString:@"document.body.className = 'pphone'"]; | |
} | |
break; | |
default: | |
if ((UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)) { | |
[webview stringByEvaluatingJavaScriptFromString:@"document.body.className = 'lpad'"]; | |
} else { | |
[webview stringByEvaluatingJavaScriptFromString:@"document.body.className = 'lphone'"]; | |
} | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment