Skip to content

Instantly share code, notes, and snippets.

@rolfbjarne
Created October 6, 2017 12: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 rolfbjarne/c74db61dd4601c873ab787e0acf10702 to your computer and use it in GitHub Desktop.
Save rolfbjarne/c74db61dd4601c873ab787e0acf10702 to your computer and use it in GitHub Desktop.
using System;
using Foundation;
using ObjCRuntime;
using UIKit;
class TID : NSObject, IUITextInputDelegate
{
public void SelectionDidChange (IUITextInput uiTextInput)
{
throw new NotImplementedException ();
}
public void SelectionWillChange (IUITextInput uiTextInput)
{
throw new NotImplementedException ();
}
public void TextDidChange (IUITextInput textInput)
{
throw new NotImplementedException ();
}
public void TextWillChange (IUITextInput textInput)
{
throw new NotImplementedException ();
}
}
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
UIWindow window;
UIViewController dvc;
UIButton button;
public void TickOnce ()
{
var field = new UITextField ();
var obj = new TID ();
field.InputDelegate = obj;
Console.WriteLine (field.InputDelegate);
}
void Tapped ()
{
TickOnce ();
}
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
window = new UIWindow (UIScreen.MainScreen.Bounds);
NSTimer.CreateScheduledTimer (0.1, (v) => Tapped ());
dvc = new UIViewController ();
dvc.View.BackgroundColor = UIColor.White;
button = new UIButton (window.Bounds);
button.TouchDown += (object sender, EventArgs e) => {
Tapped ();
};
button.SetTitleColor (UIColor.Blue, UIControlState.Normal);
button.SetTitleColor (UIColor.Gray, UIControlState.Highlighted);
button.SetTitle ("Click here", UIControlState.Normal);
dvc.Add (button);
window.RootViewController = dvc;
window.MakeKeyAndVisible ();
return true;
}
static void Main (string [] args)
{
UIApplication.Main (args, null, "AppDelegate");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment