使用 Mono Touch 的 Iphone 键盘顶部带有完成按钮的工具栏? [英] Tool bar with done button on top of keyboard for Iphone using Mono Touch?
本文介绍了使用 Mono Touch 的 Iphone 键盘顶部带有完成按钮的工具栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要使用 UIkeyboard(type) Number Pad 在工具栏上添加完成按钮,以便在单击完成按钮时退出键盘.我使用了输入附件视图,但它也添加到普通键盘,我需要在我有数字键盘的地方添加它.例如,我有一个文本字段,它只需要数字,我需要这个.除了我不想显示的地方输入附件视图.否则我需要使用 Mono Touch 为 Iphone 显示带有完成按钮的工具栏.
I need to add done button on tool bar with UIkeyboard(type) Number Pad, to resign the keyboard while click on done button. I used Input Accessory View but it adds to normal keyboard also ,i need to add this where i have number pad.For example i have a text field it takes only numbers there i need this.Other than places i don't want to show input Accessory view.Or else i need to show tool bar with Done button for Iphone using Mono Touch.
谢谢.
推荐答案
public override UIView InputAccessoryView
{
get
{
if (dismiss == null)
{
UIToolbar toolbar = new UIToolbar(new RectangleF(0, 0, 320, 30));
toolbar.BarStyle = UIBarStyle.BlackTranslucent;
dismiss = new UIView(new RectangleF(-20, -120, 320, 30));
dismissBtn = new UIButton(new RectangleF(268, 1, 50, 29));
dismissBtn.SetBackgroundImage(new UIImage("Images/done_active.png"), UIControlState.Normal);
dismissBtn.AllEvents += delegate
{
HideKeyBoard();
};
toolbar.AddSubview(dismissBtn);
dismiss.AddSubview(toolbar);
dismiss.BringSubviewToFront(dismissBtn);
dismiss.BringSubviewToFront(toolbar);
}
return dismiss;
}
}
这篇关于使用 Mono Touch 的 Iphone 键盘顶部带有完成按钮的工具栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文