iphone - Setting "device-width" property on iPad -
i'm trying implement uiwebview
display twitter webapp (the iphone version)
. it's little widget
inside ipad app
.
but, realize webapp
uses "device-width" property
determine size of webapp
. so, can't make twitter's webapp
fit 320px width uiwebview
.
my question: there someway "fake" property , set own value it?
btw: i've tried this: displaying wiki mobile page in uiwebview within uipopovercontroller
it kinda works, resizes fit webview's frame. but, reason, makes twitter show old (very old, , ugly) webapp, instead of current one.
here's webview implementation:
lateralweb = [[lateralwebview alloc] initwithnibname:@"lateralwebview" bundle:nil]; lateralweb.view.frame = cgrectmake(0, 0, 320, self.view.bounds.size.height); lateralweb.webview.autoresizingmask = uiviewautoresizingflexibleheight; lateralweb.webview.scalespagetofit = yes; lateralweb.webview.scrollview.contentsize = cgsizemake(320, self.view.bounds.size.height); [rootview insertsubview:lateralweb.view atindex:0]; [lateralweb.webview loadrequest:[nsurlrequest requestwithurl:[nsurl urlwithstring:@"http://mobile.twitter.com"]]];
here's code, lateralwebview.m, tried implement based on idea displaying wiki mobile page in uiwebview within uipopovercontroller :
-(void)webviewdidfinishload:(uiwebview *)webview{ if (hasloaded == no){ nsstring *webhtml = [nsstring stringwithcontentsofurl:self.webview.request.url encoding:nsutf8stringencoding error:null]; nsrange range = [webhtml rangeofstring:@"device-width"]; if ((range.location!=nsnotfound)&&(range.length != 0)) { webhtml = [webhtml stringbyreplacingoccurrencesofstring:@"device-width" withstring:@"320" options:0 range:range]; [self.webview loadhtmlstring:webhtml baseurl:[nsurl urlwithstring:@"http://mobile.twitter.com"]]; hasloaded = yes; } } }
Comments
Post a Comment