How To Receive Text Data From Server In iPhone.

How to receive text data from server in iPhone.

In this application we will see how to fetch data from server and replace it to the view in iPhone. This is very simple example. So let see how it will work.

Step 1: Open a Xcode, Create a View base application. Give the application name ”ReceiveData”.

Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.

Step 3: We need to add one UIViewController class in the project. So select the project -> New File -> Cocoa Touch -> ViewController subclass and give the class name “DisplayData”.

Step 4: In the ReceiveDataViewController.h file, we need to define DisplayData class , create instance of  UIButton class and define one IBAction: method. So make the following changes:

 

 

 

Step 5: Double click the ReceiveDataViewController.xib file and open it to the Interface Builder. First drag the button from the library and place it to the view window. Select the UIButton and bring up Connection Inspector, connect Touch Up Inside to File’s Owner icon and select DisplayData: method. Now save the Interface Builder and go back to the Xcode.

Step 6: Open the ReceiveDataViewController.m file and make the following changes:

 

 

 

Step 7: Now open DisplayData.h file and make the following changes:

 

 

 

Step 8: Double click the DisplayData.xib file and open it to the Interface Builder, first drag the scrollview from the library and place it to the view window and connect File’s Owner icon to the view window and select  titleScrollView. Now save the .xib file and go back to the Xcode.

Step 9: Open the DisplayData.m file and make the following changes:

 

 

 

Step 10: Now Compile and run the application in Simulator.

You can Download SourceCode from here ReceiveData

Comments 2

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">