Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 1. Before create a HTML file named mywidget.html and with content :
- // <html>
- // <head>
- // <title></title>
- // <script src="http://platform.twitter.com/widgets.js"> </script>
- // </head>
- // <body>
- // <a class="twitter-timeline" height="%i" href="https://mobile.twitter.com/DaniloPriore" data-widget id="318522515175645184" data-chrome="noheader nofooter transparent" data-border-color="#cc0000" style="display:none"> </a>
- // </body>
- //</html>
- //
- // you can take the your id number after have create a your widget from https://twitter.com/settings/widgets
- //
- // webview useragent
- NSDictionary *dictionary = [[NSDictionary alloc] initWithObjectsAndKeys:@"Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3", @"UserAgent", nil];
- [[NSUserDefaults standardUserDefaults] registerDefaults:dictionary];
- // load html file
- NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"mywidget" ofType:@"html" inDirectory:nil];
- NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
- // fit height
- htmlString = [NSString stringWithFormat:htmlString, (int)self.view.bounds.size.height];
- // show in browser (IBOutlet UIWebView *webView)
- [webView loadHTMLString:htmlString baseURL:nil];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement