Stevia
Stevia copied to clipboard
different with same constrain
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
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
}
}`
@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?
yes just using
trendingPhotoViewController!.view.heightAnchor.constraint(equalTo: scrollViewForPhotos.heightAnchor).isActive = true
instead of
trendingPhotoViewController.view.Height == scrollViewForPhotos.Height
for now :D