Alignment issues in Scroll View

Is there a way to align the object in the scroll view to a center offset instead of a left and top datum? When the view is changed from landscape to portriat it looks like a kindergardner made it. I am at a loss on how to keep a giant amout of white space from appearing when the view is changed or the app is used on larger devices. It would be much easier and very helpful if we could constrain object to the center instead of the current system for this view. Any help is much appreciated.

Accepted Reply

Select the xib in which you define your custom cell to display it in IB.


Select the object.


In the inspectors (extreme right pane of XCode), select the Size Inspector.

You will see all the constraints associated to the object.

Find the one that says "Align leading to" (usually align to superview)

If such a constraint exists :

Double click on it

A leading alignment constraint pane is displayed.

One of the items should say "superview.leading" and the other the "name of the object.leading"

click on the arrow to open each popup and replace leading by centerX.


Normally you should get bthe desired center alignment


If no such constraint exists,

control drag from the object to its superview

select "center horizontally in container"

Replies

When you define the constraints, you can set as leading, trailing or centerX.


With centerX you can also define an offset.


Is it what you are looking for ?

Yes Claude, exactly what I am looking for. Where is this center offset?

Select the xib in which you define your custom cell to display it in IB.


Select the object.


In the inspectors (extreme right pane of XCode), select the Size Inspector.

You will see all the constraints associated to the object.

Find the one that says "Align leading to" (usually align to superview)

If such a constraint exists :

Double click on it

A leading alignment constraint pane is displayed.

One of the items should say "superview.leading" and the other the "name of the object.leading"

click on the arrow to open each popup and replace leading by centerX.


Normally you should get bthe desired center alignment


If no such constraint exists,

control drag from the object to its superview

select "center horizontally in container"

Perfect! Thanks for your help Claude. Seems that Apple should just make this an easier option, esipically with all of the differnt sizes and such.