Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8256481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:52:25+00:00 2026-06-08T01:52:25+00:00

Suppose you wanna implement the same functionality iOS’s camera ‘Zoom & Crop’ has… in

  • 0

Suppose you wanna implement the same functionality iOS’s camera ‘Zoom & Crop’ has… in which you can scroll and crop an image.

Any section of the picture that exceeds the size of the crop area gets grayed out.
I’m trying to replicate exactly that. Provided that the flag ‘clipToBounds’ is set to NO, you can get the whole subview to get displayed.

However, i’m finding it a bit hard to gray out the UIScrollView’s subviews overflow.

How would you implement that?.
Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T01:52:27+00:00Added an answer on June 8, 2026 at 1:52 am

    I’ve solved this issue by…:

    • Adding a new helper class, ‘ApertureOverlay’ (subclass of UIView), with the following code:

      • (void)drawRect:(CGRect)rect
        {

        if(CGRectEqualToRect(_apertureRect, CGRectZero) == NO)

        {

        CGContextRef context = UIGraphicsGetCurrentContext();
        
        CGContextSetShouldAntialias(context, false);
        
        CGContextSetRGBFillColor(context, 1.0f, 1.0f, 1.0f, 1.0f);
        CGContextFillRect(context, _apertureRect);
        
        CGContextSetShouldAntialias(context, true);
        

        }

      }

    • ApertureOverlay has a background with the alpha byte set to 50%.

      [self setBackgroundColor:[UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:0.5f]];

    So far… al we’ve got is a view with transparent background, and a white rectangle (drawn with _apertureRect position + size).

    After implementing this class, i’ve set up the ‘mask’ attribute of the ScrollView, which contains the image inside.

    [[self layer] setMask:[_apertureOverlayView layer]];
    

    That’s it!. If you update the ApertureOverlay’s ‘_apertureRect’ attribute, you’ll need to call ‘setNeedsDisplay’, so it gets redrawn.

    One more thing. By setting the antialias to false (ApertureOverlay)… things work pretty smooth.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a subclass of UIViewController (MyViewController) which has in it's own view,
I wanna get rows in recent date, this week or month, etc. suppose the
Suppose I had a query select name from tbl where dept = 123 which
Suppose I have a FruitDetector class which takes in a string and returns the
Suppose I wanna do a join between table 1 and other tables...table 1 contains
Suppose I have a form and I wanna prevent the user from submiting the
I have a rectangle which want to move using Canvas.SetLeft(rect, x); But I wanna
I have an application which has (mostly) images in its layouts. As I understand,
I'm saving file paths in database. Suppose an image file path, which is out
suppose i have a .on() function wherein i select multiple ids $(#i, #am, #your,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.