title: Objective-C UIScrollView constraints
body: <p>I have an <code>UIScrollview</code> which will contain X views, each view is of Class type "CategoryPostView" that contains an <code>UIImageView</code>. I am adding these views on the <code>scrollView</code> one after another. But when the image loads in the <code>imageView</code> I want to change the size of my <code>imageView</code>, therefor I want to change the Offset y of my all other views in the <code>scrollView</code>.
  I am using <code>autolayout</code> constraint on <code>UIScrollView</code> but I couldn't reach to any result. This is the code I am using:</p>
  
  <pre><code>    int categoryScrollY = 0.0;
          CategoryPostView *previousView = nil;
              for(; self.indexOfCate
  
  goryInTheScroll &lt; [self.categoryItemsArray count]; self.indexOfCategoryInTheScroll++){
  
              PostItem *postItemObj = [self.categoryItemsArray objectAtIndex:self.indexOfCategoryInTheScroll];
              CategoryPostView *categoryPostViewObj = [[CategoryPostView alloc] initWithFrame:CGRectMake(0.0, categoryScrollY, 148.0, 76.0)];
              categoryPostViewObj.translatesAutoresizingMaskIntoConstraints = NO;  //This part hung me up
  
              [categoryPostViewObj setupPostViewWithItem:postItemObj];
              [self.categoriesScrollView addSubview:categoryPostViewObj];
  
  
              categoryScrollY += 80.0;
  
  
              [_categoriesScrollView addConstraints:
               [NSLayoutConstraint constraintsWithVisualFormat:@"H:|[categoryPostViewObj]"
                                                       options:0 metrics:nil
                                                         views:@{@"categoryPostViewObj":categoryPostViewObj}]];
  
              if (!previousView) { // first one, pin to top
                  [self.categoriesScrollView addConstraints:
                   [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[categoryPostViewObj]"
                                                           options:0 metrics:nil
                                                             views:@{@"categoryPostViewObj":categoryPostViewObj}]];
              }else{
                  [self.categoriesScrollView addConstraints:
                   [NSLayoutConstraint
                    constraintsWithVisualFormat:@"V:[previousView][categoryPostViewObj]"
                    options:0 metrics:nil
                    views:@{@"categoryPostViewObj":categoryPostViewObj, @"previousView":previousView}]];
              }
  
              if(self.indexOfCategoryInTheScroll == ([self.categoryItemsArray count] - 1))
              {
  
                  [self.categoriesScrollView addConstraint:[NSLayoutConstraint constraintWithItem:categoryPostViewObj
                                                                         attribute:NSLayoutAttributeRight
                                                                         relatedBy:NSLayoutRelationEqual
                                                                            toItem:self.categoriesScrollView
                                                                         attribute:NSLayoutAttributeRight
                                                                        multiplier:1.0
                                                                          constant:0]];
              }
  
              previousView = categoryPostViewObj;
  
          }
  </code></pre>
  
  <p>For now, I have the views on top of each other. I have to somehow apply my constraint from the bottom of the previous view and not from the top of the previous view. I guess I should add options to this line of code:</p>
  
  <pre><code>[self.categoriesScrollView addConstraints:
                       [NSLayoutConstraint
                        constraintsWithVisualFormat:@"V:[previousView][categoryPostViewObj]"
                        options:0 metrics:nil
                        views:@{@"categoryPostViewObj":categoryPostViewObj, @"previousView":previousView}]];
  </code></pre>
  
  <p>Many thanks!</p>