sidjdev 0 Newbie Poster

Here is the screenshot of a view That I hope to get in my ios app.. The ViewControlelr is embedded on a UIScrollView.as you can see, in the beginning there are 4 important UIViews, namely-"View1", "View2","FixedView" and "SEARCH". The UIScrollView must have size height limit at FixedView. When the "+" button is clicked A new View (View3) is to be added, bringing FixedView further down (increasing the size of the UIScrollView in the process). The Search Button is to be pinned at the bottom of the screen. There is a "-" button now that would bring the ViewController back to the original state. There is also one more View (same idea, add 1 more view), I didn't draw a picture for that. Here is the code for what I have done so far.

_frameForThree=_thirdGroup.frame;
_frameForFour=_fourthGroup.frame;
_frameForFixed=_fixedGroup.frame;
_frameForFixed.origin.x-=11;
_frameForButton=_searchButton.frame;
_originalAutoView=_viewForAuto.frame;
_thirdGroup.hidden=true;
_fourthGroup.hidden=true;
_fixedGroup.frame=_frameForThree;
_fixedGroup.frame=CGRectMake(_fixedGroup.frame.origin.x, _fixedGroup.frame.origin.y+19, _fixedGroup.frame.size.width, _fixedGroup.frame.size.height);

^^in ViewDidLoad

- (IBAction)plusInTwo:(id)sender {
_thirdGroup.hidden=false;
_thirdGroup.frame=_frameForThree;
_fixedGroup.frame=_frameForFour;
_fixedGroup.frame=CGRectMake(_fixedGroup.frame.origin.x, _fixedGroup.frame.origin.y+15, _fixedGroup.frame.size.width, _fixedGroup.frame.size.height);
_searchButton.frame=CGRectMake(_frameForButton.origin.x, _fixedGroup.frame.origin.y+160, _frameForButton.size.width, _frameForButton.size.height);
_scrollArea.contentSize = CGSizeMake(_scrollArea.frame.size.width,1.27 * _scrollArea.frame.size.height);
_twoPlus.hidden=true;
_numberOfCities=3;}


- (IBAction)plusInThree:(id)sender {
_fourthGroup.hidden=false;
_fourthGroup.frame=_frameForFour;
_fixedGroup.frame=_frameForFixed;
_searchButton.frame=_frameForButton;
_scrollArea.contentSize = CGSizeMake(_scrollArea.frame.size.width,1.44 * _scrollArea.frame.size.height);
_threeMinus.hidden=true;
_threePlus.hidden=true;
_numberOfCities=4;}


- (IBAction)minusInThree:(id)sender {
_thirdGroup.hidden=true;
_fixedGroup.frame=_frameForThree;
_fixedGroup.frame=CGRectMake(_fixedGroup.frame.origin.x, _fixedGroup.frame.origin.y+19, _fixedGroup.frame.size.width, _fixedGroup.frame.size.height);
_searchButton.frame=CGRectMake(_frameForButton.origin.x, _fixedGroup.frame.origin.y+160, _frameForButton.size.width, _frameForButton.size.height);
_scrollArea.contentSize = CGSizeMake(_scrollArea.frame.size.width,1.13* _scrollArea.frame.size.height);
_twoPlus.hidden=false;
_numberOfCities=2;}



- (IBAction)minusInFour:(id)sender {
_fourthGroup.hidden=true;
_scrollArea.contentSize = CGSizeMake(_scrollArea.frame.size.width,1.27* _scrollArea.frame.size.height);
_fixedGroup.frame=_frameForFour;
_fixedGroup.frame=CGRectMake(_fixedGroup.frame.origin.x, _fixedGroup.frame.origin.y+15, _fixedGroup.frame.size.width, _fixedGroup.frame.size.height);
_searchButton.frame=CGRectMake(_frameForButton.origin.x, _fixedGroup.frame.origin.y+160, _frameForButton.size.width, _frameForButton.size.height);
_threePlus.hidden=false;
_threeMinus.hidden=false;
_numberOfCities=3;}

Click Here
"thirdGroup" refers to View3. "fourthGroup" refers to the View4(that is not in the picture i posted as it is the same idea). OriginalAutoView and number ofCities are irrelevant to the question as it is part of the basic logic of the app and not to this view issue. Please help me with this problem and ask any doubt regarding the question