I've never actually worked with a UIWebView
before, so I'm not really sure where to begin. Effectively I'm working with a developer who's building this web platform for the app I'm currently working on. The user is supposed to fill in a form in the WebView
. One of the fields is for a destination for a ticket they want to purchase. In the app, we already have a ViewController
which is nicely laid out, allowing users to either enter a custom destination or choose from a predefined list. Would it be possible to display this ViewController
when the text field in the WebView is clicked? The field then fills with the selected destination when the user has finished. Is there a better way of doing this (without putting load on the web Developer) and I'm just being stupid?
Like I said, I've never really worked with a UIWebView in this way before as I normally like to make my apps 100% native, but here is a go at how I imagine it may work:
-(void)someMethodThatsCalledWhenTextFieldIsPressed {
AttachDestinationViewController *vc = [[AttachDestinationViewController alloc] init];
[self presentViewController:vc animated:YES completion:nil];
}
And then in the AttachDestinationViewController we would do something like:
-(void)didFinish {
CustomUIWebViewClass *parentViewController = (CustomUIWebViewClass *)self.parentViewController;
parentViewController.propertyForTextField.text = self.locationEntered.text;
[self dismissViewControllerAnimated:YES completion:nil];
}
That's how I would envision it if it were a normal ViewController, however, I have absolutely no idea how we would call -(void)someMethodThatsCalledWhenTextFieldIsPressed
, nor how we would create propertyForTextField
for the textField in the UIWebView.
Any help would be greatly appreciated,
Regards,
Mike