Neden onun işten çıkarıldığını anlamıyorum. Uygulamamda replaykit kullanıyorum ve ekranı kaydetmeyi bitirdikten sonra açılan UI'yi kapatmaya çalışıyorum. Sol üst tarafta bir iptal düğmesi var ve bastığımda önizleme denetleyicisi kapanmıyor. Denetleyiciyi reddetmek için bir temsilci işlevi var ancak benim için çalışmıyor. Bunun kolay bir çözüm olduğunu hissediyorum ama ne yapıyorum yanlış yapmıyorum. Lütfen bana yardım et. Eğer daha çok bilgiye ihtiyaç duyarsan bana haber ver. Teşekkür ederim!Swift'deki önizleme UI denetleyicisini nasıl kapatırım?
func startRecoding() {
if RPScreenRecorder.sharedRecorder().available {
RPScreenRecorder.sharedRecorder().startRecordingWithMicrophoneEnabled(true, handler: { (error: NSError?) -> Void in
if error == nil { // Recording has started
} else {
// Handle error
}
})
} else {
// Display UI for recording being unavailable
}
}
func stopRecording() {
RPScreenRecorder.sharedRecorder().stopRecordingWithHandler { (previewController: RPPreviewViewController?, error: NSError?) -> Void in
if previewController != nil {
let alertController = UIAlertController(title: "Recording", message: "Do you wish to discard or view your gameplay recording?", preferredStyle: .Alert)
let discardAction = UIAlertAction(title: "Discard", style: .Default) { (action: UIAlertAction) in
RPScreenRecorder.sharedRecorder().discardRecordingWithHandler({() -> Void in
// Executed once recording has successfully been discarded
})
}
let viewAction = UIAlertAction(title: "View", style: .Default, handler: { (action: UIAlertAction) -> Void in
self.view?.window?.rootViewController?.presentViewController(previewController!, animated: true, completion: nil)
})
alertController.addAction(discardAction)
alertController.addAction(viewAction)
self.view?.window?.rootViewController!.presentViewController(alertController, animated: true, completion: nil)
} else {
// Handle error
}
}
}
func previewControllerDidFinish(previewController: RPPreviewViewController) {
previewController.dismissViewControllerAnimated(true, completion: nil)
}
Lütfen, şimdi kapatmaya çalıştığınız görünümü görüntülemek için kullandığınız kodu gösterin. –
tamam İşlemi güncelleyeceğim. – coding22
Şimdi kontrol edebileceğiniz kodu güncelledim. – coding22