In my iPhone application i want to allow a user to download a file.(video file)
From a UIWebview i have linked download button to the video file.
Didnt worked !
Any ideas ?
Please help !
AFAIK there is not way of downloading a file from WebKit component the same way it's done on the Desktop. If you want to do something like this you should interface with webView by using something like:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
so that you can download the file properly.
Related
In my application I want to show Progressbar while downloading file from Dropbox.
Which method I use to download file ?
1) ASIHTTPRequest (but it requires URL to download)
2) DBRequest (but it requires URLRequest)
3) [[self restClient] loadFile:file.path intoPath:localPath (but how to show progress bar?)
Thanks,
Because you mention loadFile, I assume you're using the Core SDK. In that case, you'll want to implement the loadProgress delegate method.
From DBRestClient.h:
- (void)restClient:(DBRestClient*)client loadProgress:(CGFloat)progress
forFile:(NSString*)destPath;
I really want to thank you all you guys first , I began iOS programming learning several weeks ago ,and I have learnt a lot from here these days,.
I have a UIWebView and loading some html content with "loadHTMLString" method, when i click hyperlinks in the UIwebView, It comforms the
-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType{
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
[[UIApplication sharedApplication] openURL:[Request URL]];
return NO;
}
return YES;
}
to open a Safari.
My question is: Can I go back from the Safari to the UIWebView? how?
You can't get Safari to send the user back whenever you want, but one way to get back to your application is by creating a custom URL scheme (e.g. myapp://return, or whatever scheme makes sense to you), assuming that the web page the person is going to can have links that are intended to go back to your appliaction.
You can do this by registering that your application handles the URL scheme, and then processing the request appropriately when iOS tells you to. The Apple docs are fairly complete about this.
But if you want your application to be able to arbitrarily pull people back whenever you want, I don't think that's possible. Safari isn't under the control of anyone but Apple.
I really need to know how to make the dropdownTree Menu in ipad. I need to create it in my ipad app. If anyone out there knows it, please share it with me. Thanks a lot in advance.
Apple doesn't provide a native component for GUI trees. Writing one on your own can take a long time. I would rather use a webview and use a javascript tree component such as jstree or Tree Menu.
You can easily interact with the webview using these methods:
- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script
// UIWebViewDelegate method, to communicate from within the webview with the native objective-c code
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
Ok so in mobile safari you can pull up a web page and touch and hold on an image to save it to the iPhone's photo library. In a UIWebview on a view this does not happen (it pops up the alt-text and never prompts you). I'm wondering if anyone knows a way to turn this feature on.
One way to do it (on tap) would be to
grab the content
Do smart img tag finding to find all img tags
find / replace with a link to some arbitrary place http://foo.com?REAL_IMG_SRC
overload - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType in your delegate
intercept all links that contain foo.com
Use the REAL_IMG_SRC to download/present save options/etc...
So I am creating a web browser for iPhone for my class and I am having an issue where whenever I submit a form-like thing from a website, it doesn't update my address bar text (which is a UITextfield). As an example, if I go to google.com on my browser and so a search for something in the search field and hit submit, it loads a new page without changing my address bar (it's still on google.com). I have it to change for links, but I don't see how to make it so it works for forms like this. I added a NSLog in my webViewDidFinishLoading function and it doesn't say the page is loading, so I'm not sure how to detect when it changes this way. Does anyone have any ideas why it's not working?
Intercept it in this method instead:
- (BOOL)webView:(UIWebView *)webView
shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType;
The navigationType can be UIWebViewNavigationTypeLinkClicked , UIWebViewNavigationTypeFormSubmitted or others. And [request URL] will be an NSURL object with the page URL about to be loaded.