Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJivago Raymond
1,851 PointsWarning: Attribute Unavailable: Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0
Warning: Attribute Unavailable: Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0
If like me, you have set a deployment target of iOS 7.1 in the Deployment Info of your Xcode project, you should have the warning mentioned above.
The instruction that is causing trouble is when you set the number of lines to 3 for the description label.
Here is how I fixed this warning;
- Go to your file “Main.storyboard”
- Select the Playlist description label (Below the title label)
- Open the “Attributes inspector,” and in “Label / Lines” set the number of lines back to 1
- Open the “Resolve auto Layout Issues”, and "Update Frames"
The warning is now gone.
- Select the Playlist description label
- Open the “Assistant editor”
- Create an Outlet for the Playlist description label and name it playlistDescription
- Set the number of lines programmatically in the viewDidLoad() method of the PlaylistDetailViewController class by adding the following elements;
@IBOutlet weak var playlistDescription: UILabel!
override func viewDidLoad() {
playlistDescription.numberOfLines = 3
}
Tested in iOS 7.1 and iOS 8.4 simulators. Everything is fine, no warning anymore.