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

different with same constrain #100

Open
sameer4 opened this issue Oct 30, 2018 · 2 comments
Open

different with same constrain #100

sameer4 opened this issue Oct 30, 2018 · 2 comments

Comments

@sameer4
Copy link

sameer4 commented Oct 30, 2018

hi i have a view
https://imgur.com/dWNRAgE

i created a viewcontroller and i'm adding it as view in scrollview

with

trendingPhotoViewController!.view.heightAnchor.constraint(equalTo: scrollViewForPhotos.heightAnchor).isActive = true

it's fine as in above image but with

trendingPhotoViewController.view.Height == scrollViewForPhotos.Height

results in

https://imgur.com/I37nm4y

i'm adding the code if you need to look at it.

`var trendingPhotoViewController: UITrendingPhotoViewController!
var previousTrendingPhotoViewController: UITrendingPhotoViewController!

    for i in 0..<data.count
    {
        previousTrendingPhotoViewController = trendingPhotoViewController
        trendingPhotoViewController = UITrendingPhotoViewController()
        scrollViewForPhotos.addSubview(trendingPhotoViewController.view)
        arrayTrendingPhotoControllers.append(trendingPhotoViewController)
        
        trendingPhotoViewController.config(data: data[i], rank: i + 1)
        
        trendingPhotoViewController.view.translatesAutoresizingMaskIntoConstraints = false
        
        trendingPhotoViewController.view.Top == scrollViewForPhotos.Top
        trendingPhotoViewController.view.Bottom == scrollViewForPhotos.Bottom
        trendingPhotoViewController.view.Height == scrollViewForPhotos.Height
        
        if i == 0
        {
            trendingPhotoViewController.view.Leading == lblTrendingPhotos.Trailing + 20
        }
        else
        {
            trendingPhotoViewController.view.Leading == previousTrendingPhotoViewController.view.Trailing
        }
        
        if i + 1 == data.count
        {
            trendingPhotoViewController.view.Trailing == scrollViewForPhotos.Trailing
        }
    }`
@s4cha
Copy link
Member

s4cha commented Jan 7, 2019

@sameer4 This is quite weird indeed. I need to debug this to find out where the issue lies. This surely looks like a bug :/ Have you been able to find a workaround in the meantime?

@sameer4
Copy link
Author

sameer4 commented Jan 16, 2019

yes just using

trendingPhotoViewController!.view.heightAnchor.constraint(equalTo: scrollViewForPhotos.heightAnchor).isActive = true

instead of

trendingPhotoViewController.view.Height == scrollViewForPhotos.Height

for now :D

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

2 participants