Created
September 17, 2013 13:28
-
-
Save Splat/6594277 to your computer and use it in GitHub Desktop.
Given iOS7 no longer recommends or renders added subviews to the screen... And given that many people added activity indicators to alert view to block the applications main thread while blocking operations are ongoing... This takes an alert message and displays the message along with marching ants to indicate something is going on.
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
NSTimer timer; | |
UIAlertView alertView = new UIAlertView ("test", "Testing the animation\n ", null, null, new string[] {}); | |
alertView.Presented += (object sender, EventArgs e) => { | |
using (var pool = new NSAutoreleasePool()) | |
{ | |
timer = NSTimer.CreateRepeatingScheduledTimer(1, delegate { | |
if (alertView.Message.EndsWith("...")) | |
{ | |
string newMessage; | |
newMessage = alertView.Message.Remove (alertView.Message.Length - 3); | |
alertView.Message = newMessage; | |
} | |
else | |
{ | |
alertView.Message = alertView.Message + "."; | |
} | |
}); | |
NSRunLoop.Current.Run(); | |
} | |
}; | |
alertView.Dismissed += (object sender, UIButtonEventArgs e) => { | |
timer.Invalidate (); | |
timer.Dispose (); | |
timer = null; | |
}; | |
alertView.Show (); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment