我的屏幕上有一个标签,它被赋予了品牌行为。使用尺寸分类,我将标签尺寸设置为iPad的特定尺寸。当视图出现在屏幕上时,标签尺寸较小。但是,当我导航到下一个视图并返回该视图时,标签大小会按预期更改。我希望第一次显示视图时更改大小。问题是什么?
我在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 })