How to Set Control on Web View in iPhone

Introduction

In this article I will use a web view on xib and to control the web view through a bar button. Here we add a toolbar on the view. Here when we click on the bar button it shows it's corresponding action on the web view.

For this we add a bar button action on xib, to better understand we use this procedure.

Step 1

Initially we add outlets on view.

Step 2

Now we set a bar button icon through identifier.

web-view-icon-in-iphone.png

Here we set an icon "X" on the bar button; for this we select the identifier "STOP" from the Xcode inspector. 

Step 3

To make proper space between bar buttons we add "Flexible Space Bar Button item" on the tool bar.

add-outlet-in-iphone.png

Step 4

Now we set the bar button control through it's corresponding action. Here we set the action for the bar button to "BACK".

Start by right-clicking on the first bar button back. 

link-selector-to-web-view-in-iphone.png

Click on Selector and add it on the web view.

Step 5

Now here we see the action shown on the view set action corresponding button.

Here we select acton "goback" for the "BACK" button.

add-action-on-web-view-in-iphone.png

After adding action:

action-go-back-in-iPhone.png


Similar Articles