和老师视频里的效果不一样。
import UIKit
class PositionViewController: UIViewController {
@IBOutlet weak var redSquare: UIView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func viewDidAppear(animated: Bool) {
UIView.animateWithDuration(1, animations: {
self.redSquare.center.x = self.view.bounds.width - self.redSquare.center.x})
}
为啥和老师的效果不一样呢?