C# 如何在xamarin.ios/monotouch上隐藏UIWebView的InputAccessoryView?
在Xamarin.ios/monotouch上是否有隐藏或替换UIWebView的InputAccessoryView的方法?我想你指的是monotouch.Dialog中HtmlElement的单元格附件。这种灵活性似乎没有包含在实现中,但很容易添加 转到: 复制HtmleElement类定义(撰写本文时的第527行到第640行),并将其重命名为WhateverYouWantElement。修改GetCell方法:C# 如何在xamarin.ios/monotouch上隐藏UIWebView的InputAccessoryView?,c#,ios,uiwebview,xamarin.ios,xamarin,C#,Ios,Uiwebview,Xamarin.ios,Xamarin,在Xamarin.ios/monotouch上是否有隐藏或替换UIWebView的InputAccessoryView的方法?我想你指的是monotouch.Dialog中HtmlElement的单元格附件。这种灵活性似乎没有包含在实现中,但很容易添加 转到: 复制HtmleElement类定义(撰写本文时的第527行到第640行),并将其重命名为WhateverYouWantElement。修改GetCell方法: public override UITableViewCell GetCel
public override UITableViewCell GetCell (UITableView tv)
{
...
static NSString hkey = new NSString ("WhateverYouWantElement"); //very important to set a unique cell reuse identifier here!
...
cell.Accessory = UITableViewCellAccessory.None;
...
}
这将创建一个没有公开指示符的单元格。重用标识符将确保与内置HtmlElement没有冲突。您是否尝试过创建
UIWebView
的子类并重写其InputAccessoryView
属性以使其返回null
private class CustomWebView : UIWebView
{
public override UIView InputAccessoryView
{
get
{
return null;
}
}
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
// Perform any additional setup after loading the view, typically from a nib.
RectangleF frame = new RectangleF(0, 0, 200, 30);
UITextField txfTest = new UITextField();
txfTest.Frame = frame;
txfTest.BorderStyle = UITextBorderStyle.RoundedRect;
txfTest.Placeholder = "Click here";
txfTest.EditingDidBegin += (object sender, EventArgs e) => {
// do something
};
CustomWebView webView = new CustomWebView();
webView.LoadRequest(new NSUrlRequest(new NSUrl(@"http://google.com")));
webView.Frame = new RectangleF(0, 100, 320, 480);
webView.AddSubview(txfTest);
this.View.AddSubview(webView);
}
我试图将UITextField
添加到UIWebView
中,但在聚焦UITextField
后,没有显示输入附件。我正在使用IPhone模拟器6.1。