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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:25:17+00:00 2026-05-29T08:25:17+00:00

i am using objective-c to develop ios applications i found in the documentations that

  • 0

i am using objective-c to develop ios applications

i found in the documentations that enum have default values like this : “1<<0”

i don’t understand this default value
example:

enum {
    UIDataDetectorTypePhoneNumber   = 1 << 0,
    UIDataDetectorTypeLink          = 1 << 1,
    UIDataDetectorTypeAddress       = 1 << 2,
    UIDataDetectorTypeCalendarEvent = 1 << 3,
    UIDataDetectorTypeNone          = 0,
    UIDataDetectorTypeAll           = NSUIntegerMax
};

so, what is the default value for each element in this enum ?

thanks

  • 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-29T08:25:18+00:00Added an answer on May 29, 2026 at 8:25 am

    That is an enum with bitwise values or bit flags. Each value is an binary value in which only one bit is set to 1 and all the others are set to 0. That way you can store in a value as much flags as bits of an integer number has.

    The shift left operator ‘<<‘ is a displacement of bits to the left or to the most significant side of the binary number. It is the same that calculating a “* 2” (times two) operation.

    For example in the enum you have send in your question, the first value, UIDataDetectorTypePhoneNumber, is 1. The second one, UIDataDetectorTypeLink, is 2 and the third one, UIDataDetectorTypeAddress, is 4.

    You combine that values as flags to set some different bits in the same integer:

    NSInteger fooIntValue = UIDataDetectorTypePhoneNumber | UIDataDetectorTypeLink;
    

    As ‘|’ operation is bitwise, the result will be a binary value …0011, that is 3. And you are indicating that your variable fooIntValue has two flags set to true for two different properties.

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

Sidebar

Related Questions

We have a collection of commercial MFC/C++ applications which we sell using Stingray Objective
Actually I have read about that I can write Objective-C app on Linux (using
I'm learning Objective-C using GNUstep, because I don't have a Mac and the GNUstep
I am using Objective-C and trying to create int values that are between 1-99
Is there a way to develop windows applications using cocoa and objective-c in general
I am using objective c, and I got some variables like this: 1100 920
What is the best way to generate random numbers using Objective-C on iOS? If
Before I start: I'm programming for Iphone, using objective C. I have already implemented
I am using an Objective c class, a subclass of NSObject. This class cannot
I'm using Objective-C language. But I don't know how to use c with Objective-C.

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.