0

I want to open my UIImagePickerController when user taps on file input field in UIWebView. Currently UIWebView opens its own UIIMagePickerController on which I don't have any control.

Andy Obusek
  • 12,614
  • 4
  • 41
  • 62
Rahul Dange
  • 131
  • 6

1 Answers1

0

One way to do it would be to change the url when the user taps on the file input field. There's an answer about doing something similar here: Is it possible to update a url link based on user text input?

Then your UIWebView will need to catch that url change and open your UIImagePickerController. That can easily be done with this chunk of code:

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
    NSString *URLString = [[request URL] absoluteString];
    if ([URLString isEqualToString:@"http://www.mywebsite.com/selectpic.htm"]) 
    {
        // Your UIImagePickerController code here
    }
    return YES;
}
Community
  • 1
  • 1
Segev
  • 19,035
  • 12
  • 80
  • 152