헤드폰 버튼과 같은 원격 제어 이벤트 수신을위한 작동 예제가 표시된 모노 터치 용 작동 예제가 있는지 알고 싶습니다.모노 터치 원격 제어 이벤트가 작동하지 않습니다.
저는 하나의 뷰 아이폰 앱을 구현했으며, BecomeFirstResponder라고도하는 CanBecomeFirstResponder와 UIApplication.SharedApplication.BeginReceivingRemoteControlEvents()를 구현했지만 어떤 이벤트도받지 못했습니다.
다음은 내 SingleViewController 코드입니다.
public partial class SingleViewViewController : UIViewController
{
public SingleViewViewController() : base ("SingleViewViewController", null)
{
}
public override void DidReceiveMemoryWarning()
{
// Releases the view if it doesn't have a superview.
base.DidReceiveMemoryWarning();
// Release any cached data, images, etc that aren't in use.
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
// Perform any additional setup after loading the view, typically from a nib.
AVAudioSession audioSession = AVAudioSession.SharedInstance();
NSError error;
audioSession.SetCategory(AVAudioSession.CategoryPlayback, out error);
audioSession.SetActive(true,out error);
this.BecomeFirstResponder();
UIApplication.SharedApplication.BeginReceivingRemoteControlEvents();
}
public override void ViewDidUnload()
{
base.ViewDidUnload();
// Clear any references to subviews of the main view in order to
// allow the Garbage Collector to collect them sooner.
//
// e.g. myOutlet.Dispose(); myOutlet = null;
ReleaseDesignerOutlets();
}
public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation)
{
// Return true for supported orientations
return (toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown);
}
public override bool CanBecomeFirstResponder {
get {
return true;
}
}
public override bool CanResignFirstResponder {
get {
return false;
}
}
public override void RemoteControlReceived (UIEvent theEvent)
{
base.RemoteControlReceived (theEvent);
}
}