What happens in UIWebView when "Go" Button is touched - iphone

If you have a UIWebView with a textfield and a button that takes the value from that textfield and then performs some action.
When you touch the textfield, the keyboard is displayed with a Go Button. I'm trying to figure out what exactly happens under the hood when that Go Button is pressed?
How I would simulate that action programmatically?

The following will be used, when user press on GO button of Keyboard ...
NSString *urlAddress = mytextFieldText.text;
//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *aRequest = [NSURLRequest requestWithURL:aURL];
//load the index.html file into the web view.
[aWebView loadRequest:aRequest];
Thanks
Check the below SO post for listening to keyboard GO button in UITextField.
Dismiss iphone keyboard

Related

Issue in playing vimeo video in webview

In my app there is a vimeo video. I have opened it in WebView using following code ;
NSURL *url = [NSURL URLWithString:#"https://vimeo.com/47278503"];
NSURLRequest *req = [NSURLRequest requestWithURL:url];
webview.delegate = self;
[webview loadRequest:req];
And place one cancel button above the WebView to close the vimeo video.
But the problem is that audio still plays after closing the WebView by clicking that cancel button.
And another issue is that on viewing full screen, video is not showing ,only audio plays in background and after clicking cancel button the video is playing in background.
UPDATE :
There is a similar issue in link. I have tried it's code but it doesnt work. I have written the code
[self.view addSubview:self.view.window.rootViewController.view];
in tableview's didSelectRowAtIndexPath() method. (and this tableview is in popover).
I have also tried [self.view addSubview:self.view.window.rootViewController.view]; in WebView's viewDidLoad() , but it doesnt work.
What can be the issue ?
Thanks.
for stop BG sound. you just remove, release and set nil to your UIWebView.

Open the Phone (Call) with a button and a Text field/View (iPhone) and come back to the application back

Hello, I have successfully developed an application in which clicking on UIButton the Mobile no in UITextField dialled.
But I am not able to come back in my application. Is it possible to come back on the page from which I have dialled the Mobile number.
-(void)newuser:(id)sender;
{
NSString *URLString = [#"tel://" stringByAppendingString:#")172-123456"];
NSURL *URL = [NSURL URLWithString:URLString];
[[UIApplication sharedApplication] openURL:URL];
}
Thanks
No, an application receiving a URL to process doesn't get information about the sender. Besides, as far as I know the Phone application doesn't have a Back button either.
not sure which iOS version this was implemented in but I use this simple approach in my latest app 'App Time' which is to launch the call from within a UIWebview, but doesn't require anything more than...
UIWebView *webView = [[UIWebView alloc] init];
NSURL *telURL = [NSURL URLWithString:#tel://yourNumber"];
[webView loadRequest:[NSURLRequest requestWithURL:telURL]];
the user is prompted to confirm the call with a UIAlertview but will be brought back to the same screen after the call completes.

How to program UItoolbar buttons to load a new website in UIWebView?

I am working on an IPhone app and i have a UIWebview that by default loads a url.
I need to create a UIToolbar with three buttons under UIWebview which will allow users to hit the buttons and load a new url in UIWebview?
you have to add three buttons to your toolbar( This can be easily done by using the Interface builder(IB) and connect them to there respective IBAction in the IB.
now when tap on a a button you can do like this.
you have a UIWebView say myWebView //declared in .h file and properly linked with the your View using IB.
when you are done with the basic initialization
for button1 press
-(IBAction)button1:(id)sender
{
NSURL *url = [NSURL URLWithString:#"http://www.google.com"];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[myWebView loadRequest:requestObj];
}
so by clicking on the button1 google webpage is loaded in your webView.
do the same for other button also.
:)
These methods and properties of UIWebview maybe help:
- (void)reload;
- (void)stopLoading;
- (void)goBack;
- (void)goForward;
#property(nonatomic,readonly,getter=canGoBack) BOOL canGoBack;
#property(nonatomic,readonly,getter=canGoForward) BOOL canGoForward;
#property(nonatomic,readonly,getter=isLoading) BOOL loading;

How can I use UIWebView in Objective-C to display a Webpage

I've been trying to implement UIWebView into my application for a while now but when I do my application crashes upon startup.
My code is:
-(void)viewDidLoad {
[super viewDidLoad];
NSString *urlAdress=#"http://www.facebook.com";
NSURL *url = [NSURL URLWithString:urlAdress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
The Debugger says Thread 1: Stopped at breakpoint 4
Your problem is that you have breakpoints set. See the blue arrow in the narrow column immediately left of your code? You have three of them set. You can disable the break point by clicking on the blue breakpoint arrow so that it dims (disabled). You can remove the breakpoint by right clicking on the blue arrow and removing it. A second way to remove it is to click and drag the breakpoint into the main window of your code, causing it to use the same dissolve animation used on the Mac OS X dock when you remove an item from it.

iOS button to webpage with uiwebview

For a current project I am embedding a mobile site into an iOS app. I've taken use of the goback() and goforward() functions, with UIWebView. But how would I make a custom function that onClick (or onTouch which ever is the correct term) Sends the UIWebView back to the page initially loaded? Any Help would be much appreciated as I have bene unable to find anything on the web thus far.
Add something like to the implementation file:
- (IBAction)loadPage:(id)sender;
{
NSURL *url = [NSURL URLWithString:#"http://www.stackoverflow.com/"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
}
And add this to the header file (each line at the appropriate position):
- (IBAction)loadPage:(id)sender;
IBOutlet UIWebView *webView;
Then bind the button to loadPage within interface builder,
and bind webView to the UIWebView.
Response to comment:
I created this sample project, hopefully it helps:
- http://dd5.org/static/iPhone_Browser_Sample.zip
Binding the button:
Right-click and drag to the class where you added the code above.
Release the button. Now a little dark-gray panel should appear.
Then click on the loadPage: entry within that panel.
If the code was added correctly, the entry should show up there.