如何使用MonoTouch在UIKeyboard顶部添加UIToolbar? [英] How to add a UIToolbar on top of UIKeyboard using MonoTouch?

查看:47
本文介绍了如何使用MonoTouch在UIKeyboard顶部添加UIToolbar?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照Obj-C中的示例在自定义iPhone键盘中查找Windows SubViews中的UIKeyboard,但是,我不知道如何使用MonoTouch做到这一点.我不知道描述"是什么.如果它是UIView的属性,则无法从MonoTouch访问它??

I follow the example in Obj-C at Custom iPhone Keyboard for finding the UIKeyboard in the Windows SubViews, however, I don't know how to do this using MonoTouch. I don't know what the "description" is. If it is a property of UIView I cannot access it from MonoTouch???

有人可以像在Obj-C示例中那样在C#中找到可用于MonoTouch的UIKeyboard的例子吗?

Can someone please provide an example of finding the UIKeyboard as in the Obj-C sample but in C# for use in MonoTouch?

谢谢.

推荐答案

我假设您正在寻找与Safari中的键盘相同的东西(即,它的顶部有一个小的工具栏,增加了额外的功能,如图所示).最右边的图像此处)

I assume you're looking for the same thing as the keyboard in Safari (i.e. it has a small toolbar at the top that adds extra functionality, as seen on the far right image here )

在这种情况下,您要查找的是Input Accessory View(iOS 3.2及更高版本).在Monotouch中,执行此操作的方法是在视图控制器中覆盖输入附件视图".我以前使用的一个简单示例

In that case, what you're looking for is the Input Accessory View (iOS 3.2 and above). In Monotouch, the way to do this is to override Input Accessory View in your view controller. A simple example I've used before

public override UIView InputAccessoryView 
{
    get 
    {
        UIView dismiss = new UIView(new RectangleF(0,0,320,27));
        dismiss.BackgroundColor = UIColor.FromPatternImage(new UIImage("Images/accessoryBG.png"));          
        UIButton dismissBtn = new UIButton(new RectangleF(255, 2, 58, 23));
        dismissBtn.SetBackgroundImage(new UIImage("Images/dismissKeyboard.png"), UIControlState.Normal);        
        dismissBtn.TouchDown += delegate {
             subjectField.ResignFirstResponder();
        };
        dismiss.AddSubview(dismissBtn);
        return dismiss;
    }
}

这只是在键盘顶部创建了一个UIView,然后您可以像往常一样向视图添加任何内容.

This just creates a UIView across the top of the keyboard, you can then add whatever you'd like to the view as normal.

这篇关于如何使用MonoTouch在UIKeyboard顶部添加UIToolbar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆