![](/img/trans.png)
[英]How to prevent Xamarin.Forms.Entry Keyboard to be Unfocused when Pressing a Button
[英]Play clicking sound when pressing button custom keyboard XAMARIN
我已經找到了實現此目標的目標c答案,但是我對如何在C#(Xamarin)中實現這一目標感到困惑,因為在目標c中似乎UIInputViewAudioFeedback是一個接口,但是在C#中沒有稱為UIInputViewAudioFeedback的接口是一個名為UIInputView的類。 我將如何使用該課程。 該類中似乎沒有ViewDidLoad方法,因此將事件附加到視圖中使用的按鈕會使應用程序崩潰。 我將如何處理?
編輯:這是一些代碼:
public partial class CustomDigitKeyboard : UIViewController, IUIInputViewAudioFeedback
{
public CustomDigitKeyboard(){}
public bool EnableInputClicksWhenVisible{
get{
return true;
}
}
public override void ViewDidLoad()
{
DoneBtn.TouchUpInside += (s,e) =>{
UIDevice.CurrentDevice.PlayInputClick();
};
}
}
單擊按鈕時仍然沒有聲音。 這個實施正確嗎?
Xamarin具有IUIInputViewAudioFeedback接口-您的自定義鍵盤視圖應實現此接口。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.