Skip to content

Instantly share code, notes, and snippets.

@martinbowling
Created March 26, 2010 23:32
Show Gist options
  • Save martinbowling/345526 to your computer and use it in GitHub Desktop.
Save martinbowling/345526 to your computer and use it in GitHub Desktop.
if (KeyboardType == UIKeyboardType.NumberPad)
{
NSNotificationCenter.DefaultCenter.AddObserver (
"UIKeyboardDidShowNotification", (notification) => {
UIButton doneButton = new UIButton(new RectangleF(0, 163, 106, 53)); //{ButtonType = UIButtonType.Custom};
//doneButton.SetTitle("Done", UIControlState.Normal);
doneButton.SetImage(UIImage.FromFile("DoneUp.png"), UIControlState.Normal);
doneButton.SetImage(UIImage.FromFile("DoneDown.png"), UIControlState.Highlighted);
doneButton.AdjustsImageWhenHighlighted = false;
UIWindow window = UIApplication.SharedApplication.Windows[1];
foreach (var v in window.Subviews)
{
//NSString desc = Runtime.GetNSObject (Messaging.IntPtr_objc_msgSend (v.Handle, Selector.GetHandle ("description")));
NSObject desc = Runtime.GetNSObject (Messaging.IntPtr_objc_msgSend (v.Handle, Selector.GetHandle ("description")));
Console.WriteLine(desc.ToString());
if (desc.ToString ().StartsWith ("<UIKeyboard")) {
//v.Tag = 313377269;
//KeyboardHandle = v.Handle;
v.AddSubview(doneButton);
}
}
doneButton.TouchUpInside += delegate {
entry.ResignFirstResponder();
};
Console.WriteLine ("Keyboard went up");
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment