UIWebView not showing properly on iPad - iphone

I am building a very simple application for iphone and ipad with a UIWebView which load site, but there is an issue, it is working properly on iphone but on iPad the site moved upward and is even not scrollable.
Following are the screenshots:
iphone:
ipad:
You can see the header section on ipad is not visible, please help me.
here is .m file code
UIWebView *myWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0,0,myView.frame.size.width,myView.frame.size.height)];
myWebView.delegate = self;
myWebView.scalesPageToFit = YES;
NSString *urlString = #"http://www.webhousemedia.com/?";
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[myWebView loadRequest:requestObj];
myWebView.frame = [[UIScreen mainScreen] bounds];
[self.view addSubview:myWebView];

try this..
UIWebView *myWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0,0,self.view.bounds.size.width,self.view.bounds.size.height)];

Related

Instagram login in iPhone sdk

I am implementing instagram in my application.I am following the code from "https://github.com/crino/instagram-ios-sdk"
This code is working fine and instagram call is made in the app delegate.
"self.instagram = [[Instagram alloc] initWithClientId:APP_ID delegate:nil]"
But I want to use this in the view controller not in the app delegate.
When I try to do that it is not calling the "-(void)authorize:(NSArray *)scopes" method and so Instagram is not loading.
Please suggest me some way out for this.
Found the solution. My code:
self.webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
self.webView.delegate = self;
NSURLRequest* request = [NSURLRequest requestWithURL:[NSURL URLWithString: [NSString stringWithFormat:kAuthenticationEndpoint, kClientId, kRedirectUrl]]];
[self.webView loadRequest:request];
[self.view addSubview:self.webView];
Where: kAuthenticationEndpoint=#"https://instagram.com/oauth/authorize/?client_id=%#&redirect_uri=%#&response_type=token%22;
My code:
UIWebView *webViewInstagram = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
webViewInstagram.delegate = self;
[webViewInstagram setDelegate:self];
[self.view addSubview:webViewInstagram];
NSString *urlRedirect = #"REDIRECT_URL";
NSString *clientId = #"CLIENT_ID";
NSString *url = [NSString stringWithFormat:#"https://instagram.com/oauth/authorize/?client_id=%#&redirect_uri=%#&response_type=token",clientId, urlRedirect];
NSURLRequest* request = [NSURLRequest requestWithURL:[NSURL URLWithString: url] cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:30];
[webViewInstagram loadRequest:request];

How to show a PDF page by page using horizontal swipe in iphone?

I would like to add to my app a pdf viewer which can scroll horizontally. Anyone know how to do it? I'm making several attempts but without success. Thanks. Matteo
Use UIWebViewController in landscape orientation and this piece of code can give you an idea about how to display pdfs:
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake( 0, 0, 320, 480 )];
NSString *path = [[NSBundle mainBundle] pathForResource:#"about" ofType:#"pdf"];
NSURL *targetURL = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[webView loadRequest:request];
webView.scalesPageToFit = YES;
[self.view addSubview:webView];
[webView release];

Display pdf from the weburl iphone sdk

I am working on one project I want to display the pdf which is on the website, I have the url of the pdf any idea how I can do it.
Also I want to create a thumbnail of the pdf which is on the website.
you could display a pdf in your device.
Passing the url to UIWebView directly.
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 360, 420)];
NSURL *targetURL = [NSURL URLWithString:#"http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIWebView_Class/UIWebView_Class.pdf"];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[webView loadRequest:request];
[self.view addSubview:webView];
[webView release];

iphone : how can we store pdf file in local and read it?

i want to store pdf file in local and read it . i want to read this pdf same as iphone read data in mkmapview.
means i want to create same as pdf(Acrobat) reader.how can i do this?
you can store the pdf in the application bundle and display it using a uiwebview:
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(10, 10, 200, 200)];
NSString *path = [[NSBundle mainBundle] pathForResource:#"document" ofType:#"pdf"];
NSURL *targetURL = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[webView loadRequest:request];
[self.view addSubview:webView];
[webView release];
to load it from an url you can do something like this:
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(10, 10, 200, 200)];
NSURL *targetURL = [NSURL URLWithString:#"http://www.mywebsite.com/myPdfFile.pdf"];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[webView loadRequest:request];
[self.view addSubview:webView];
[webView release];
you can also download your pdf into the documentDirectory during runtime and load it from there.
i think you need this
http://github.com/akisute/iPhonePDF
from here you can find code (api) by that you can genrate pdf in iphone .
and also can do edit it.
Let me know this is what you need ?
You can open the PDF with iBooks or any other app that can read PDF files to store it locally on the Phone.

UIWebView Youtube embed sound plays but no video shows in iOS 3.2 (iPad)

I'm using a UIWebView to display YouTube videos. It works fine on iOS 4+ but doesn't work on the iPad (iOS 3.2). The UIWebView loads as expected and displays the thumbnail of the video. When I tap on the thumbnail I see a gray quicktime icon and can hear sound but no video appears.
This is the code I'm using:
UIWebView* webView = [[UIWebView alloc] initWithFrame: CGRectMake(0,0,320,480)];
NSURL *url = [NSURL URLWithString:#"http://url.to.video/"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
VideoPlayerController* videoController = [[VideoPlayerController alloc] init];
[[videoController view] addSubview:webView];
UINavigationController* theNavController = [[UINavigationController alloc]
initWithRootViewController:videoController];
[self presentModalViewController:theNavController animated:YES];
[videoController release];
[theNavController release];
[webView release];
This is a bug with iOS 3.2 on the iPad. It will (hopefully) be fixed when iOS 4.2 is released in November.