private void AddViewObservers() { _observer = new KVOObserver(); _kvoController = FBKVOController.ControllerWithObserver(_observer); _kvoController.Observe(View, "frame", NSKeyValueObservingOptions.OldNew, CallbackFromKVO); _kvoController.Observe(View.Layer, "bounds", NSKeyValueObservingOptions.OldNew, CallbackFromKVO); }
private void RemoveViewObservers() { if (_kvoController != null) { _kvoController.UnobserveAll(); _kvoController.Dispose(); _kvoController = null; } if (_observer != null) { _observer.Dispose(); _observer = null; } }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. PlayItem = new UIBarButtonItem(UIBarButtonSystemItem.Play, (sender, e) => { DidTapPlay(PlayItem); }); StopItem = new UIBarButtonItem(UIBarButtonSystemItem.Stop, (sender, e) => { DidTapStop(StopItem); }); PauseItem = new UIBarButtonItem(UIBarButtonSystemItem.Pause, (sender, e) => { DidTapPause(PauseItem); }); _KVOController = FBKVOController.ControllerWithObserver(this); NSNotificationCenter.DefaultCenter.AddObserver(AVPlayerItem.DidPlayToEndTimeNotification, PlayerDidPlayToEnd); }