Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

constraints attribute? for optimizing for device size? #885

Open
baalpeteor opened this issue Jul 13, 2019 · 0 comments
Open

constraints attribute? for optimizing for device size? #885

baalpeteor opened this issue Jul 13, 2019 · 0 comments

Comments

@baalpeteor
Copy link

is there an attribute/tag to be called for altering constriants for optimization for device size? I have the below code but doesn't work using "iCarouselConstraint.constant" as this doesn't see to exist? The origina lcode was for changing the size of a static image.

The end goal is to have iCarousel resizing if it's an iphone 4/6 or ipad, so the app isn't bunched up (in my case play buttons) and the view fills out good. Thanks

   
    func optimizeForDeviceSize() {
        
        // Adjust album size to fit iPhone 4s, 6s & 6s+
        let deviceHeight = self.view.bounds.height
        
        if deviceHeight == 480 {
            iCarouselConstraint.constant = 106
            
            view.updateConstraints()
        } else if deviceHeight == 667 {
            iCarouselConstraint.constant = 230
        
            view.updateConstraints()
        } else if deviceHeight > 667 {
            iCarouselConstraint.constant = 260
            view.updateConstraints()
        }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant