Errata for Auto Layout by Tutorials 1st Edition

Hi @fischej and thanks for your feedback! The next edition will update to support the Xcode 12 changes.

Chapter 11 “Dynamic Type”, page 245: Two illustrations missing that are referenced in the text.

Hi @fischej, thanks for your feedback! It seems like the PDF (legacy) edition excluded the two illustrations referenced in the text. Please check out the online or ePub version for the illustrations referenced in the text.

Chapter 6 in the section for UICollectionViews, implementing the code to preserve the StoryEventCollectionView upon device rotation does not work. I tried running the final version of the app, just in case I missed something in the tutorial, and still got this output on the console.

**2020-11-24 10:40:20.131077-0500 MessagingApp[43955:2682967] The behavior of the UICollectionViewFlowLayout is not defined because:**

**2020-11-24 10:40:20.131214-0500 MessagingApp[43955:2682967] the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values.**

**2020-11-24 10:40:20.131839-0500 MessagingApp[43955:2682967] The relevant UICollectionViewFlowLayout instance is <UICollectionViewFlowLayout: 0x7fe811610da0>, and it is attached to <UICollectionView: 0x7fe812844000; frame = (0 32; 568 288); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x60000230a730>; animations = { bounds.origin=<CABasicAnimation: 0x600002d01a40>; bounds.size=<CABasicAnimation: 0x600002d01a80>; position=<CABasicAnimation: 0x600002d01b20>; }; layer = <CALayer: 0x600002d3b600>; contentOffset: {320, 0}; contentSize: {1280, 504}; adjustedContentInset: {0, 0, 0, 0}; layout: <UICollectionViewFlowLayout: 0x7fe811610da0>; dataSource: <MessagingApp.UserStoryViewController: 0x7fe81160ea50>>.**

**2020-11-24 10:40:20.131961-0500 MessagingApp[43955:2682967] Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.**

Just posted the same issue at the bottom of this thread. I’m running Xcode 12.2 with the iPod Touch simulator running iOS 14.2

Hi @jayvenn! I’ve experienced the same issue: It’s the final code at the end of Ch. 6 (but without Challenges). Adding func scrollViewWillEndDragging and the rest of the code for proper sizing and centering of the collectionView items in landscape mode, there is no effect – you still see multiple userStory events in landscape mode. The same happens with the final Ch 6 code in the code bundle (“final”, I haven’t tried “challenge”).

I’m on Xcode 12.2; it happens in simulator running iPhone SE (2nd gen), iOS 14.2, and on my iPhone 8 (also running iOS 14.2).

Thank you!

@thebelg @sammeyer3 @steveaz Thanks for the Chapter 6 inputs!

Using the environments mentioned from the comment, I was able to recreate the problem where:

In UserStoryViewController, implementing the code to preserve StoryEventCollectionViewCell’s centering and full-screen sizing upon device rotation doesn’t work as expected.

The problem is due to:

the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values.

One way to resolve this issue is to replace:

override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
  super.viewWillTransition(to: size, with: coordinator)
  centerCollectionViewContent()
}

With:

override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
  super.viewWillTransition(to: size, with: coordinator)
  collectionView.reloadData()
  centerCollectionViewContent()
}

After device rotation, the collection view re-calculates the cell sizes. Afterward, the collection view updates the content offset using the latest cell sizes.

Your feedback makes a difference. And, I have a feeling that your feedback will help make the next edition better for everyone! :]

1 Like

Last report (I hope!): C18 “Designing Custom Controls” Page 378-380, after adding the code under “Implementing Value Adjustability,” the pitch control no longer adjusts (i.e., the thumb no longer moves vertically, and it was working just prior to this). When I try to slide it, VoiceOver just repeats the announcement of the name of the control and its accessibility features. I verified this behavior is in the Final version of the project as well. Xcode 12.3, running on iPhone XS Max with iOS 14.3. There is one console message:

**2020-12-18 14:54:35.557148-0800 CustomControls[4709:1032093] [AXRuntimeCommon] Unknown client: CustomControls**

Perfect, thank you @jayvenn!

In private func centerCollectionViewContent() right before // 2 should add : self.collectionView.reloadData() to resize the cells, not just center to the last scrolled.