Last active
December 14, 2015 01:39
-
-
Save jfoshee/5008117 to your computer and use it in GitHub Desktop.
An RAII style class for setting UIView.AnimationsEnabled MonoTouch / Xamarin.iOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using MonoTouch.UIKit; | |
public sealed class UIViewAnimations : IDisposable | |
{ | |
public UIViewAnimations(bool enabled) | |
{ | |
_wasEnabled = UIView.AnimationsEnabled; | |
UIView.AnimationsEnabled = enabled; | |
} | |
public void Dispose() | |
{ | |
UIView.AnimationsEnabled = _wasEnabled; | |
} | |
bool _wasEnabled; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use it like this: