Skip to content

Instantly share code, notes, and snippets.

@patridge
Created February 4, 2015 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patridge/a1ff0fbdfcab35b81454 to your computer and use it in GitHub Desktop.
Save patridge/a1ff0fbdfcab35b81454 to your computer and use it in GitHub Desktop.
Sample reproduction of MTMBProgressHUD issue with iOS 6
using System;
using System.Linq;
using System.Collections.Generic;
using Foundation;
using UIKit;
using CoreGraphics;
using MBProgressHUD;
namespace HudCrashSample {
public class HudCrashViewController : UIViewController {
UITextView someView;
public override void ViewDidLoad() {
base.ViewDidLoad();
someView = new UITextView() {
BackgroundColor = UIColor.LightGray,
Text = "This is a test UITextField",
};
someView.Frame = new CGRect(new CGPoint(6f, 6f), new CGSize(View.Bounds.Width - 12f, 50f));
Add(someView);
var hud = new MTMBProgressHUD(View) {
LabelText = "Waiting...",
RemoveFromSuperViewOnHide = true
};
View.AddSubview(hud);
hud.Show(animated: true);
hud.Hide(animated: true, delay: 5);
}
}
[Register("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate {
public override UIWindow Window { get; set; }
UIViewController rootController;
public override bool FinishedLaunching(UIApplication app, NSDictionary options) {
rootController = new HudCrashViewController();
Window = new UIWindow(UIScreen.MainScreen.Bounds);
Window.RootViewController = rootController;
Window.MakeKeyAndVisible();
return true;
}
// This method is invoked when the application is about to move from active to inactive state.
// OpenGL applications should use this method to pause.
public override void OnResignActivation(UIApplication application) {
}
// This method should be used to release shared resources and it should store the application state.
// If your application supports background exection this method is called instead of WillTerminate
// when the user quits.
public override void DidEnterBackground(UIApplication application) {
}
// This method is called as part of the transiton from background to active state.
public override void WillEnterForeground(UIApplication application) {
}
// This method is called when the application is about to terminate. Save data, if needed.
public override void WillTerminate(UIApplication application) {
}
}
public class Application {
static void Main(string[] args) {
AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
try {
UIApplication.Main(args, null, "AppDelegate");
}
catch (Exception ex) {
HandleException(ex);
}
}
static void OnUnhandledException(object sender, UnhandledExceptionEventArgs e) {
HandleException(e.ExceptionObject as Exception);
}
static void HandleException(Exception exception) {
Console.WriteLine("Top-level exception: {0}", exception);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment