scroll view not working in iOS6??

Skip to first unread message


Nov 27, 2012, 9:07:12 AM11/27/12
I'm working through fall 2011 CS193P.

I'm working my way through lecture 8, the Imaginarium lecture, and I've followed his instructions to the letter up to the point where he enables the scroll view, sets the scroll view content size, and shows (on the simulator) that scroll view is working.   No worky for me--picture comes up, but I can't get it to scroll.    I've followed all of his instructions to the letter twice, same result.  

There have been a few things over which I've stumbled due to differences between iOS5 (in which the course was conducted) and iOS6 (in which I'm working)--for example the way rotation is handled.

  1. Is there some subtlety that is omitted inadvertently in the lecture that everyone taking the course knows about which I'm clue-challenged?
  2. Is there some obvious mistake in the lecture?  (Doubtful, we see him do the code and then press run, but who knows what editing has happened...OK, I'll take off my tin-foil hat now)
  3. Is there some subtlety about scroll views in iOS6?
  4. Is there some magic cntrl-alt-meta-delete key chord that is necessary to scroll the scroll view in the slime-u-lator that isn't immediately obvious from the lecture?
  5. Is there some magic debug NSLog stuff I can throw in there that'll help me unnerstan what is going on (or more accurately, not going on)?
  6. For years I've played a game with my friends/fambly and anglicized french by adding aye-voo on the ends of things, lunch-ay-voo? for instance, inviting my bro to meet for lunch.  I almost titled this append:  scroll-aye-view not working in iOS6 :-)


Nov 28, 2012, 8:37:33 AM11/28/12
Partial answer to my own question:  Someone over on youTube had a similar question, and a respondent said:  use viewDidAppear instead of viewDidLoad.  I used viewDidAppear AND viewDidLoad, replicating viewDidLoad from example as follows:  -(void)viewDidAppear:(BOOL)animated{[super viewDidAppear:animated]; self.scrollView.delegate=self; self.scrollView.contentSize = self.imageView.image.size; self.imageView.frame = CGRectMake(0, 0, self.imageView.image.size.width, self.imageView.image.size.height); }

Still not working for zooming.

Duane Bender

Nov 28, 2012, 9:30:16 AM11/28/12
I can eliminate a few of your possibilities. I just loaded my old Assignment 5 from last winter into Xcode 4.5 and ran it on the iOS 6 iPhone simulator. Scrolling and zooming both work as before.


Tamás Jäger

Nov 28, 2012, 10:00:34 AM11/28/12

I know you followed everything to the letter but since there's no reference to it in your posted code-fragment, I must ask: did you set the minimumZoomScale/maximumZoomScale properties to anything other than 1,1? Did you implement the delegate method for zooming? (viewForZoomingInScrollView:)

Scales can be set in IB as well as programatically.

Hope this helps!

ps: keep it in viewDidLoad, there's no need to do it in viewDidAppear

You received this message because you are subscribed to the Google Groups "iPhone Application Development Auditors" group.
To view this discussion on the web visit
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Pete Osler

Nov 28, 2012, 10:49:44 AM11/28/12
Tomas--thanks for your suggestions--the answers to both of your questions are:  yes and yes!  ...and zooming is definitely broken (when I try and zoom, the screen goes white and is unresponsive, although the simulator doesn't crash)

Additional odd behaviors are:
  • when I rotate iPad from portrait to landscape, scrolling stops working
  • when I rotate iPad back to portrait, scrolling continues to not work

I tried downloading the imaginarium zip file from the class website--unzipped--ran successfully, both scrolling and zooming worked perfectly.  I compared my code w/the class code, compared my story-board w/class story-board.  Code was verbatim, storyboard the same, started digging around in story-board, outlets and delegates all matched.  I then noticed that when I used the inspector on the scroll-view in the class implementation, the inspector used the struts-and-springs paradigm, but when I inspected the scroll-view in my implementation, the inspector used the autolayout paradigm.  So there is something embedded in the CS193P implementation that causes the old paradigm to be used, and the old-paradigm seems to work with much less obsfuscated messing around than the new paradigm. 

 in re:  viewDidLoad vs viewDidAppear:  this is a difference between iOS5 and iOS6.  I'm working in iOS6.  Scrolling definitely did not work when I only implemented viewDidLoad.  Scrolling definitely worked when I implemented both viewDidLoad and viewDidAppear, and implementing viewDidAppear was the only change that I made between scrolling not working and scrolling working.  If you have some additional information that will enable scrolling in iOS6 without implementing viewDidAppear, I'd love to hear it, or potentially some way to debug why scrolling isn't working in iOS6 when I've only implemented viewDidLoad?

Pete Osler
cp:     802 324 4199

Richard Nerf

Nov 28, 2012, 11:32:48 AM11/28/12
Any possibility there was a change in the behavior of the simulator with Mountain/Lion?  I got caught recently when I expected a tableview to scroll by a trackpad gesture, then figured out I needed to keep the mouse button down for scrolling to work.  This seemed unfamiliar to me.


Pete Osler

Nov 28, 2012, 12:17:17 PM11/28/12
Ah--Another undocumented pheechur--for the scroll view, uncheck use autolayout in file inspector (if you're confused like me about which inspector is what, the inspectors are in the right-most-column in xcode.  The file inspector is the leftmost icon of the 6, looks like a portrait-view page with the right corner clipped off)
Reply all
Reply to author
0 new messages