I have a detailed view controller. It is made up of dynamic, model based, text label subviews that are placed by code on the view within a scrollview with set spacing. I have anchored the last text label (lastLabel) to the scrollview bottom anchor with the following:
The above line was added on the suggestion from a DTS ticket, and it solved some other label subview and scroll view issues.
However, the problem I'm having, on all device sizes by the way, is that if I start in portrait orientation, my lastLabel is displayed as expected with correct spacing to the previous (above) text label, but then when I rotate to landscape orientation, then rotate back to portrait orientation, the lastLabel is shifted down and spacing to the previous (above) label is increased.
If I navigate back to the parent view, then return again to the detail view in portrait orientation, the lastLabel is correctly positioned again relative to the previous (above) label.
I don't seem to be able to figure out how to fix this bug so that the lastLabel on the view always retains the proper spacing to the previous (above) label, even after transitioning from landscape to portrait orientation.
I do not see this problem when transitioning from portrait to landscape. The landscape orientation always displays the lastLabel in the correct relative position to the previous (above) label.
Code Block scrollView.bottomAnchor.constraint(equalTo: lastLabel.bottomAnchor, constant: 0).isActive = true
The above line was added on the suggestion from a DTS ticket, and it solved some other label subview and scroll view issues.
However, the problem I'm having, on all device sizes by the way, is that if I start in portrait orientation, my lastLabel is displayed as expected with correct spacing to the previous (above) text label, but then when I rotate to landscape orientation, then rotate back to portrait orientation, the lastLabel is shifted down and spacing to the previous (above) label is increased.
If I navigate back to the parent view, then return again to the detail view in portrait orientation, the lastLabel is correctly positioned again relative to the previous (above) label.
I don't seem to be able to figure out how to fix this bug so that the lastLabel on the view always retains the proper spacing to the previous (above) label, even after transitioning from landscape to portrait orientation.
I do not see this problem when transitioning from portrait to landscape. The landscape orientation always displays the lastLabel in the correct relative position to the previous (above) label.