I have a label on my screen which is given marque behaviour. Using size classes I made the label size to a specific size for iPad. When the view appears on screen, the label size is smaller.But, when I navigate to next view and come back to that view, the label size is changed as expected. I want the size to be changed first time the view appears. What is the issue?
I wrote the following code in viewWillAppear
lblScrollingNotification.frame.origin.x = ScreenSize.SCREEN_WIDTH
lblScrollingNotification.text = "This is a sample text to check the animation of the text in home screen"
lblScrollingNotification.sizeToFit()
UIView.animate(withDuration: 12.0, delay: 1, options: ([.curveLinear, .repeat]), animations: {() -> Void in
self.lblScrollingNotification.center = CGPoint(x: self.lblScrollingNotification.bounds.size.width / 2, y : self.lblScrollingNotification.center.y)
}, completion: { _ in })
I wrote the above code in viewDidLayoutSubviews instead of viewWillAppear. That solved the issue.