2016-08-22 82 views
1

這裏是啓動和停止功能。是否可以用Replaykit錄製屏幕的一部分?

@IBAction func startRecordingAction(sender: AnyObject) { 
      activityView.hidden = false 

     // start recording 
     recorder.startRecordingWithMicrophoneEnabled(true) { [unowned self] (error) in 
      dispatch_async(dispatch_get_main_queue()) { 
       [unowned self] in 
       self.activityView.hidden = true 
      } 

      if let error = error { 
       print("Failed start recording: \(error.localizedDescription)") 
       return 
      } 

      print("Start recording") 
      self.buttonEnabledControl(true) 


     } 
    } 

    @IBAction func stopRecordingAction(sender: AnyObject) { 
     activityView.hidden = false 

     //end recording 
     recorder.stopRecordingWithHandler({ [unowned self] (previewViewController, error) in 
      dispatch_async(dispatch_get_main_queue()) { 
       self.activityView.hidden = true 
      } 

      self.buttonEnabledControl(false) 

      if let error = error { 
       print("Failed stop recording: \(error.localizedDescription)") 
       return 
      } 

      print("Stop recording") 
      previewViewController?.previewControllerDelegate = self 



      dispatch_async(dispatch_get_main_queue()) { [unowned self] in 
       // show preview vindow 
       self.presentViewController(previewViewController!, animated: true, completion: nil) 
      } 
     }) 
    } 
func screenRecorderDidChangeAvailability(screenRecorder: RPScreenRecorder) { 
     let availability = screenRecorder.available 
     print("Availability: \(availability)\n"); 
    } 

    // MARK: - RPPreviewViewControllerDelegate 
    // called when preview is finished 
    func previewControllerDidFinish(previewController: RPPreviewViewController) { 
     print("Preview finish"); 

     dispatch_async(dispatch_get_main_queue()) { 
      [unowned previewController] in 
      // close preview window 
      previewController.dismissViewControllerAnimated(true, completion: nil) 
     } 
    } 

我只想錄制屏幕的一部分,我想顯示自定義的警報,而不是ReplayKit標準警報消息。我可以使用3方的豆莢,沒問題。 也許你可以用不同的方式給我建議,不需要ReplayKit

回答

0

不幸的是,您現在無法使用Replay Kit來記錄特定的UIView

對於在這裏記錄特定視圖是一些替代方法的希望,這可以幫助你。

https://github.com/wess/Glimpse 

https://github.com/adam-roth/screen-cap-view 

https://github.com/andydrizen/UIViewRecorder 

希望這可以幫助你。

相關問題