title: how to scroll to the center position of the object
body: <p>Hi Im making a simple game with the basic <code>UIKit</code> stuff where there is an object that pops up on the screen. </p>
  
  <p>I'm trying to make it so that every time the object pops up the screen will scroll to the object and center it on screen. Basically I have a <code>UIView</code> that has the objects that popup within it and that <code>UIView</code> is a subview of a <code>UIScrollView</code>. All of this is a subview of <code>self.view</code> of my <code>ViewController</code>. I'm using the <code>UIScrollview</code> to scroll through the contents of its subview with the objects in it. I'm not sure if a <code>UIScrollView</code> is the ideal option for what I want to do but I was looking for a way to scroll the position of the object and center it in the middle of the device. Ideally with animation. </p>
  
  <p>If anyone knows of a method or maybe a formula that could help me out that would be awesome. Thanks in advance :D</p>
  
  <p>Update:
  I don't really have much code in regards to this except for adding the views within each other :</p>
  
  <pre><code>self.world =  [[UIView alloc]initWithFrame:CGRectMake(0, 0, currentDeviceWidth*4, currentDeviceHeight*2.2)];
  self.world.backgroundColor = [UIColor blueColor];
  
  _scrollView = [[UIScrollView alloc] initWithFrame:[[self view] bounds]];
  [_scrollView setContentSize:self.world.frame.size];
  
  [_scrollView addSubview:self.world];
  [[self view] addSubview:_scrollView];
  </code></pre>
  
  <p>but below is a simple image of what I want to accomplish. The arrows are just a representation of the possible scrolling direction.</p>
  
  <p>Apple object is off the side of the screen Note: apple object is a subview of self.world and self.world is a subview of scrollview</p>
  
  <p><img src="https://i.stack.imgur.com/N3VYv.png" alt="apple object is off the side of the screen Note: apple object is a subview of self.world and self.world is a subview of scrollview"></p>
  
  <p>The finish look is where now the scrollview has scroll self.world to where the apple object is in the center of the screen</p>
  
  <p><img src="https://i.stack.imgur.com/IVKb1.png" alt="The finish look is where now the scrollview has scroll self.world to where the apple object is in the center of the screen"></p>
  
  <p>Just looking to basically accomplish how a user could manually scroll the object to the center but instead do it automatically without the use of a user's touch. </p>