Git Product home page Git Product logo

Comments (2)

alskipp avatar alskipp commented on September 18, 2024

Perhaps UIAlertView doesn't appear in the app's list of UIWindows?. If this is the case, I'm not sure if there's a way of dealing with it.

As for displaying an overlay over the keyboard, you'll have to make an alteration to the delegate method writeBackgroundFrameInContext: (or create a new delegate method writeOverlayFrameInContext).

A quick hack would be to change the following lines in the .m file:

        if (self.delegate) {
            [self.delegate writeBackgroundFrameInContext:&bitmapContext];
        }
        // draw each window into the context (other windows include UIKeyboard, UIAlert)
        // FIX: UIKeyboard is currently only rendered correctly in portrait orientation
        dispatch_sync(dispatch_get_main_queue(), ^{
            UIGraphicsPushContext(bitmapContext); {
                for (UIWindow *window in [[UIApplication sharedApplication] windows]) {
                    [window drawViewHierarchyInRect:CGRectMake(0, 0, _viewSize.width, _viewSize.height) afterScreenUpdates:NO];
                }
            } UIGraphicsPopContext();
        });

to:

        // draw each window into the context (other windows include UIKeyboard, UIAlert)
        // FIX: UIKeyboard is currently only rendered correctly in portrait orientation
        dispatch_sync(dispatch_get_main_queue(), ^{
            UIGraphicsPushContext(bitmapContext); {
                for (UIWindow *window in [[UIApplication sharedApplication] windows]) {
                    [window drawViewHierarchyInRect:CGRectMake(0, 0, _viewSize.width, _viewSize.height) afterScreenUpdates:NO];
                }
            } UIGraphicsPopContext();
        });
        if (self.delegate) {
            [self.delegate writeBackgroundFrameInContext:&bitmapContext];
        }

The delegate drawing will now occur on top of the app window (for my use case I needed to draw live video and overlay the app controls over the video, that's why the delegate draws beneath the app window by default).

Then in your view controller, implement the delegate method [ASScreenRecorder sharedInstance].delegate = self;:

- (void)writeBackgroundFrameInContext:(CGContextRef*)contextRef {
  // create overlay CGRect
  CGRect overlayRect = …
  // set overlay color
  CGContextSetFillColor(contextRef, …
  // fill rect with overlay color in `contextRef`
  CGContextFillRect(contextRef, overlayRect)
}

from asscreenrecorder.

pfeidemine avatar pfeidemine commented on September 18, 2024

Thank you so much for the quick answer !
The solution with overlay works perfectly !

The one for UIAlertView didn't had time to test, will come back with an reply to that also in a couple of days.

from asscreenrecorder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.