title: How to embed a UIImageView into a UIScrollView in iOS using Xcode 4.5
body: <p>I am trying to learn how to use the UIScrollView and I am hitting a simple roadblock it seems.</p>
  
  <p>I am able to create an empty UIScrollView build and run and it works.  I then try to add an image and I can get the image to show but I am unable to scroll.</p>
  
  <p>Here is the code contents of my viewcontroller.h file:</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface ViewController : UIViewController
  @property (weak, nonatomic) IBOutlet UIScrollView *scrollView;
  
  @end
  </code></pre>
  
  <p>In viewcontroller.m:</p>
  
  <pre><code>#import "ViewController.h"
  
  @interface ViewController ()
  
  @end
  
  @implementation ViewController
  @synthesize scrollView;
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
      [scrollView setScrollEnabled:YES];
      [scrollView setContentSize:CGSizeMake(320, 500)];
  }
  
  - (void)didReceiveMemoryWarning
  {
      [super didReceiveMemoryWarning];
      // Dispose of any resources that can be recreated.
  }
  
  @end
  </code></pre>
  
  <p>I added the UIImageView via the interface builder.  It is embedded within the scroll view.  The size of the image is also greater than the scroll view.  Here is the screenshot:</p>
  
  <p><img src="https://i.stack.imgur.com/ylLrI.png" alt="enter image description here"></p>
  
  <p>When I build and run I get a full screen view of a part of the image but cannot scroll to see the rest.  Any clue as to why I cannot scroll to see the rest of the image?</p>