While developing newgusto.com for iPhone I encountered this problem, It is really simple to solve but, since I've seen a lot of questions about this topic, I'm going to describe how to do the work, with a simple and short tutorial.

Let's start opening the Xcode.
Now let's create a new project (I'm going to call it "remoteImageLoader")

Choose the utility template

Then, name it remoteImageLoader

Select the storyboard and add the following three Items:
  • UIImageView
  • UIButton
  • UITextField
The storyboard should look like as follows:

Select the viewController.h file and modify its content to reach the following result:


//  ViewController.h

//  remoteImageLoader


//  Created by Luigi D'Andrea on 11/07/12.

//  Copyright (c) 2012 xAppSoftware.com. All rights reserved.



#import <UIKit/UIKit.h>


@interface ViewController : UIViewController


    UIImageView   *theImageView;

    UITextField   *theImageAddress;


@property (nonatomicretain)IBOutlet UIImageView *theImageView;

@property (nonatomicretain)IBOutlet UITextField *theImageAddress;





Open the viewController.m file and, after the "@implementation ViewController" line, add the following code:

@synthesize theImageView, theImageAddress;




    NSURL   *imageURL   = [NSURL URLWithString:theImageAddress.text];

    NSData  *imageData  = [NSData dataWithContentsOfURL:imageURL];

    UIImage *image      = [UIImage imageWithData:imageData];


    theImageView.image  = image;




Select the storyboard and connect the edit text field to UITextfield (theImageAddress) and the UIImageView to the UIImageView (theImageView) and then the UIButton to the loadImage method.

Now run the project.
In the editfield type http://www.xappsoftware.com/wordpress/wp-content/uploads/2012/07/Screen-shot-2012-07-11-at-19.45.17-300×198.png
click the button 

that's all