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

  • Home
  • SEARCH
  • 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 5962841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:09:44+00:00 2026-05-22T19:09:44+00:00

Ok this is a bizarre issue… rather than posting lots of code I will

  • 0

Ok this is a bizarre issue… rather than posting lots of code I will post a few snippets that will explain:

This is a action sheet that I have added a UIDatePicker

in my .h file

NSInteger tagOfDateToUse;

in my .m file I make sure its clear on ViewDidLoad

tagOfDateToUse = 0;

I need this variable because there are multiple text boxes on a screen that could be pulling up this action sheet. So I set this int so that if its a 100 it will go to one text box, if its a 101, it goes to another

I set the tagOfDateToUse in the IBAction. Then in the

(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {

… Do some things

It works fine with the 1st one (100) but when I Hit my second button it is 101 up to this point.

As soon as it hits the if tagOfDateToUse is __ it thinks it’s 100 when up to this point it has been 101… what in the if statement is causing it to go back to 100… What am I missing here…

if (tagOfDateToUse = 100) {vacation_starton.text = [[NSString alloc] initWithFormat:@"%@", [formatter stringFromDate:selectedDate]];
    }
    else if  (tagOfDateToUse = 101)
    {
     vacation_endon.text = [[NSString alloc] initWithFormat:@"%@", [formatter stringFromDate:selectedDate]];

    }

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-22T19:09:45+00:00Added an answer on May 22, 2026 at 7:09 pm

    You are assigning a value of 100 to tagOfDateToUse which is perfectly legal and then the value is evaluated as a boolean condition in which anything but 0 is true and only 0 is false.

    Try changing it to this…

    if (tagOfDateToUse == 100)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use a temp directory that will be unique to this build.
This is a somewhat bizarre question. My objectives are to understand the language design
This is my first post here and I wanted to get some input from
This is beyond both making sense and my control. That being said here is
This is a bit of a long shot, but if anyone can figure it
This is starting to vex me. I recently decided to clear out my FTP,
This is kinda oddball, but I was poking around with the GNU assembler today
This might seem like a stupid question I admit. But I'm in a small
This is a difficult and open-ended question I know, but I thought I'd throw
This past summer I was developing a basic ASP.NET/SQL Server CRUD app, and unit

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.