[英]Record sound from microphone in Monotouch.Dialog
Xamarin示例可在以下位置找到: http ://docs.xamarin.com/samples/Sound可以運行,但是GUI不是Monotouch.Dialog,並且與我的其他MD APP一起看起來很差。
如何添加Monotouch.Dialog控制器,以開始和停止錄制,以及顯示錄制時所經過的時間。
蘋果使用隨附的VU表制作了http://developer.apple.com/library/ios/#samplecode/SpeakHere/Introduction/Intro.html 。
看看Xamarin示例中的此類https://github.com/xamarin/monotouch-samples/blob/master/Sound/Sound/SoundViewController.cs
基本上,您將要創建自己的DialogViewController
:您將需要示例中的using
語句。
using MonoTouch.AVFoundation;
using System.Diagnostics;
using System.IO;
using MonoTouch.AudioToolbox;
public class SoundRecorder : DialogViewController {
this.Title = "Record Sound";
root = new RootElement() {
new section () {
new StringElement ("Record", delegate {
// sound recording code from sample for the first button
}
}
}
}
這應該給您一個開始。
您可能想要分隔元素,並分別聲明它們,如下所示:
StringElement myElement = new StyledStringElement("record something");
然后,您可以使用委托來訂閱輕擊事件,並以這種方式處理按鈕何時被按下的事件。 這樣您可以做更多的事情。 對於更多樣式選擇,您需要一個StyledStringElement
希望這可以幫助
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.