views:

184

answers:

2

Hi there, I'd like to put the following interface in place : I'd like to have a uiscrollview taking all the screen (big picture to be zoomed...) On top of that "scrolling image" : I'd like have 2 buttons (e.g.back and instructions) redirecting th user to other views.

Could you drop me a code snippet where I understand how to organize the UIView and UIScrollview in order to have scrolling layer but with selectable non scrolling buttons on top of it ?

many thanks...

+1  A: 

Simple:

Container view
 |
 +--- Scroll view
 |     |
 |     +--- Scroll view's content view
 |
 +--- Button 1
 |
 +--- Button 2
Ole Begemann
:-) indeed, That's What I did in my app : I can see the scrollview but not the button ...I'll have a check, because I think, even my scrollview is defined through the Interface Builder, I still create it afterwards in my viewcontroller ... doing so I'm getting rid of the button in the interface builder ... right ?
Tibi
Uh, what? Sorry, I really don't understand what you are talking about.
Ole Begemann
And make sure that the scroll view is "sent to back" in the IB layout.
Graham Lee
A: 

Hum, indeed no one would understand what I wrote ... even me. Sorry for that.

Before asking the question on stackoverflow, I had a try on UIScrollView. The situation is : 1) I've got a xib and a viewcontroller file with 2 buttons that are working perfectly. 2) I implement in the code the scrollview (filling the window bounds) and add it from the code to the current view (self.view addsubview ...) Result : only the scrollview is displayed and no button is visible.

I guess it comes from the fact that I did not add a scrollview in the xib files (using interface builder) ...

So now, with YOUR answer, I guess I need to create the view tree you wrote above in the xib file (interface builder) and link the controller view to each view element.

Except the Scroll view's content view which I'll create dynamically from the controller code.

Is it more clear ? ;-)

Tibi