mamaral / Onboard

An iOS framework to easily create a beautiful and engaging onboarding experience with only a few lines of code.
MIT License
6.46k stars 765 forks source link

Auto-Layout issues #73

Closed inadeem closed 9 years ago

inadeem commented 9 years ago

Hello, so I got everything working on my app. I thought I had everything with Auto-layout done but unfrotunately it is not properly scaled on some devices (iPad, iPhone 5s etc..)

I added this code :

//**

    imageView.contentMode = .ScaleAspectFit
    imageView.clipsToBounds = true
    imageView.setTranslatesAutoresizingMaskIntoConstraints(false)
    self.view.addSubview(imageView)
    self.view.addConstraint(NSLayoutConstraint(item: imageView, attribute: .Bottom, relatedBy: .Equal, toItem: self.view, attribute: .Bottom, multiplier: 1, constant: 0))
    self.view.addConstraint(NSLayoutConstraint(item: imageView, attribute: .CenterX, relatedBy: .Equal, toItem: self.view, attribute: .CenterX, multiplier: 1, constant: 0))

    imageView.addConstraint(NSLayoutConstraint(item: imageView, attribute: .Width, relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute, multiplier: 1, constant: 300))

    imageView.addConstraint(NSLayoutConstraint(item: imageView, attribute: .Height, relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute, multiplier: 1, constant: 900))

   imageView.frame = CGRect ()

    // ******************

and also edited some of the Constants for the padding. But unfortunately it hasn't worked.

Do you have any methods of configuring auto-layout through code?

mamaral commented 9 years ago

I'm not really sure what I'm looking at or what you're trying to achieve here? I'm not using auto-layout for anything in this framework, and I have exposed padding properties for you to customize the spacing between elements.

key

inadeem commented 9 years ago

Yes, I changed up a lot of the padding properties, but the problem is that the layout isn't consistent with every iOS device.

For example, in iPhone 6 it shows up alright, then in iPhone 5S and iPad the images and text are all over the place. If I changed up the padding properties so that it looks good on the iPad, then it wouldn't look good on the iPhone 6 etc..

I played around with the settings to get something where it looks decent in all devices, and that should be good for now, but eventually I will look into setting up Auto-Layout.

I love the product and really appreciate all of your help!