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 6555907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:52:38+00:00 2026-05-25T12:52:38+00:00

I am using the ZBar SDK for iPhone in order to scan a barcode.

  • 0

I am using the ZBar SDK for iPhone in order to scan a barcode. I want the reader to scan only a specific rectangle instead of the whole view, for doing that it is needed to set the scanCrop property of the reader to the desired rectangle.

I’m having hard time with understanding the rectangle parameter that has to be set.

Can someone please tell me what rect should I give as an argument if on portrait view its coordinates would be: CGRectMake( A, B, C, D )?

  • 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-05-25T12:52:38+00:00Added an answer on May 25, 2026 at 12:52 pm

    From the zbar’s ZBarReaderView Class documentation :

    CGRect scanCrop

    The region of the video image that will be scanned, in normalized image coordinates. Note that the video image is in landscape mode (default {{0, 0}, {1, 1}})

    The coordinates for all of the arguments is in a normalized float, which is from 0 – 1. So, in normalized value, theView.width is 1.0, and theView.height is 1.0. Therefore, the default rect is {{0,0},{1,1}}.

    So for example, if I have a transparent UIView named scanView as a scanning region for my readerView. Rather than do :

    readerView.scanCrop = scanView.frame;
    

    We should do this, normalizing every arguments first :

    CGFloat x,y,width,height;  
    x = scanView.frame.origin.x / readerView.bounds.size.width;
    y = scanView.frame.origin.y / readerView.bounds.size.height;
    width = scanView.frame.size.width / readerView.bounds.size.width;
    height = scanView.frame.size.height / readerView.bounds.size.height;
    
    readerView.scanCrop = CGRectMake(x, y, width, height);
    

    It works for me. Hope that helps.

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

Sidebar

Related Questions

I am using zbar sdk in my project but it is not scanning barcode
I'm new to iPhone development and Objective-C. Using the ZBar SDK I've developed a
Am developing sample barcode scanner app. I using ZBar API to scan the barcode
I developing Barcode Scanner sample app in iPhone. Am using ZBar framework in iphone,
I am working on a barcode reader app in iPhone. I am using the
Using C#, I want to format a decimal to only display two decimal places
I am currently using ZBar for scanning and while it does work very well,
Using WPF/PRISM I want to log my messages through ILoggerFacade to my GUI (A
I am using zbarcam to read barcode from a webcam in my webapps. But,
Using the RichTextArea in GWT, It looks like I can only change the font

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.