On 4 Jun 2013, at 10:04 PM, Rick Mann <rm...@latencyzero.com> wrote:

> Hi. I've got an iOS 6.1 iPad app that lays out fine in the iPad sim and on a 
> Retina iPad device.

I'd wager the problem shows up on iPad 2 (which is still sold) as well. I'm 
going to simplify, and look only at the lower toolbar.

# Some not-very-helpful research

I'm going to concentrate on that lower toolbar, in hopes of simplifying the 
problem.

This is all in the Simulator, and you've already said you don't have a problem 
there. I'm reporting my research to be thorough; and because I'm surprised that 
placement constraints don't appear in the .constraints arrays of both superview 
and subview.

Skip this part.

## It behaves correctly in the Simulator.

Using the simulator, hardware set to the non-Retina iPad, I don't see the bug. 
I took the single-view template, dropped a toolbar at the bottom (placing it 
inside the provided root view), verified that the vertical constraint was 
bottom space to superview (0), and inserted a flexible space to the left of the 
button the toolbar template includes. It behaved as expected when rotated.

(I know you said the bug doesn't manifest in the simulator. I'm being thorough.)

## The toolbar has no placement constraints, but the superview does

However: At -viewDidLoad time, neither the root view nor the toolbar had 
constraints. If I inspect the toolbar after sending the root view 
-layoutIfNeeded, or in an IBAction handler, it has only the vertical-size 
constraint. No vertical placement, no horizontal.

But: The root view does have leading- trailing- and bottom-edge constraints on 
the toolbar. I thought constraints belonged to both views. Is that just a 
convenient conceit in Interface Builder?

## Autoresizing translation and .autoresizesSubviews don't change anything

I set setTranslatesAutoresizingMaskIntoConstraints: to NO on both views. No 
change. I set .autoresizesSubviews to NO on the root view. No change. The 
toolbar laid out correctly, and it lacked constraints back to the root view.

Switching the simulator to iPad (Retina) had no effect. Rotation had no effect. 
Layout always worked as expected.

Obviously I don't know autolayout well enough.

---

# Further questions

> Sometimes, the top is okay, but the toolbar along the bottom is shifted 
> upward about a toolbar width.
> 
> The "215 MiB" is a separate view on top of the top toolbar. The icons on the 
> left and right, and the title in the center, are UIBarButtonItem elements in 
> the toolbar.

Describe your particular case:

* Where in the view hierarchy is the bottom toolbar placed?
* What are its constraints as listed in Interface Builder?
* What are they in the debugger (.constraints), for the toolbar, after layout 
has been forced?
* For the superview?
* Have you experimented with setTranslatesAutoresizingMaskIntoConstraints:?
* With .autoresizesSubviews?

        — F

-- 
Fritz Anderson
Xcode 4 Unleashed: 4.5 supplement for free!
http://www.informit.com/store/xcode-4-unleashed-9780672333279


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to