Elements in Scroll View shift/move upon returning to the SV?

176 views Asked by At

I am working in a tabbed aplication type. And my problem is shown on the 3. step (see picture below): http://www.photoshack.com/albums/userpics/13055/Problem1.png

Here is my storyboard: http://www.photoshack.com/albums/userpics/13055/StoryBoard.png

Additional info:

  • All three Views are UIViewControllers.
  • The "Programs" and "CreateNewProgram" have a Scroll View.
  • Autolayout is turned off.
  • The "CreateNewProgram" View is pushed via Modal View on IBAction onClicked for the "Create Program" button.
  • All objects in the "Programs" View have "Autosizing" set to left ,top.
  • All the objects shift together for a few pixels to the bottom when I go back.
  • This ONLY HAPPENS WHEN I USE A SCROLL VIEW (to go back to).
  • I used a scroll views because the will be more options in "Programs" & "CNP"

Here are some additional informations about the environment and tech I work in : Xcode 5, iOS sdk 7, mac mini,mac OS X, Tabbed aplication type.

I really have no clue why this is happening and where to make modifications.

EDITED: 23.01.2014.

I am trying to use autolayout. And the problem persists even though I added all constraints (for every element) without errors/warnings. The elements only move in the UIScrollView. I tested it on a UIView without a UIScrollView and it worked normally. I still have no clue why this is happening... :-(

1

There are 1 answers

0
Geet On BEST ANSWER

Looks to me Like the frame of your scroll view is getting modified… try setting your scroll view frame in viewWillAppear method such as:-

-(void)viewWillAppear{

  self.scrollview.frame=CGRectMake(0,0,320,460);

}