View Full Version : Aligning Images and Buttons Using Multiple Views

Apr 14, 2009, 11:28 AM

I am creating an application with a main view and six other views that load into the main view. All of the views contain a different image that are the same size(1053x598) and all have the same set of buttons at the bottom. I am using Interface Builder. How can I make sure that ALL of the images and buttons are positioned in the same location in ALL of my views... Meaning... when I switch views I want the images and buttons to be in the exact same spot as the view I just switched from. Thank You.

Apr 14, 2009, 02:16 PM
Since the image is larger than the screen size does that mean that they're in a scrollview? If so the contentOffset property of the scrollview indicates how the content view has been scrolled. Just read the contentOffset from the current view and use that to set the contentView for the new view.

If you're not using a scrollview then tell us how the images and buttons are laid out.

Apr 14, 2009, 02:53 PM
Thanks... I am forcing the app to load in landscape mode... Is this the incorrect size to use for my images still? I am basically adding the images to my resource folder in xcode then adding them to my views in interface builder. As for the buttons, I am creating them in interface builder as well. My hope is that I am able to align all the views using interface builder. Is that possible?

Apr 15, 2009, 09:46 AM
The screen size is 480x320 so your images are obviously much larger than that. If they can't scroll then I don't understand the point of having them that size.

You can certainly have several views set up with the same positions for buttons and other subviews and switch between them. You could also have a single view hierarchy and just switch an image in an imageview.