You can also use KVO:
You can set KVO as follows, where view is the view you want to watch for frame changes:
self.addObserver(view, forKeyPath: "center", options: NSKeyValueObservingOptions.New, context: nil)
And you can get changes with this notification:
override func observeValueForKeyPath(keyPath: String!, ofObject object: AnyObject!, change: NSDictionary!, context: CMutableVoidPointer) { }
observeValueForKeyPath will be called whenever the frame of the view you are observing changes.
Also remember to remove the observer when your view is released:
view.removeObserver(self, forKeyPath:@"center")
Lefteris
source share