3

这是启动和停止功能。

@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.

4

1 回答 1

3

不幸的是,您现在无法UIView使用 /Using记录特定内容Replay Kit

对于记录特定视图,这里有一些替代方法,希望对您有所帮助。

https://github.com/wess/Glimpse

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

https://github.com/andydrizen/UIViewRecorder

希望这可以帮助你。

于 2017-08-18T06:41:41.377 回答