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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:40:31+00:00 2026-06-09T01:40:31+00:00

I just finished Stanford’s iPhone lesson that uses AVFoundation. It was the class where

  • 0

I just finished Stanford’s iPhone lesson that uses AVFoundation. It was the class where the TA had us make an App that displayed video and then put sunglasses on the face with face recognition. So I wanted to hook up a couple of switches and sliders to do different things. The first was a slider that changed the value of the hue filter. Then I wanted to make a switch to show the sunglasses or not. But the switch does not turn the sunglasses off. Although the switch works. I declared a BOOL in the properties with

@property (nonatomic) BOOL sunGlasses;  

I synthesized it and then hooked the switch up to the following action

- (IBAction)toggleGlasses:(id)sender 
{
if (_mySwitch.on)
{
    NSLog(@"toggle is on");
    self.sunGlasses = YES;
}else {
    NSLog(@"toggle is off");
    self.sunGlasses = NO;
}
}

Then under the method for -(void) captureOutput, that is where the hue gets changed and the face recognition is I added to the face recognition portion

if ((faceFound) && (self.sunGlasses = YES)){
    [self.glasses setHidden:NO];
}else{
    [self.glasses setHidden:YES];
}

It used to be just if (faceFound) and then hid the glasses or showed them. However, this does not make the glasses go away if you switch the switch to off.

  • 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-09T01:40:33+00:00Added an answer on June 9, 2026 at 1:40 am

    You used:

    self.sunGlasses = YES
    

    The single = is an assignment. It sets the value of that property, and when this statement is used within a larger expression it’s value is YES. So the “if” condition is always true and the branch that shows sunglasses is always taken.

    Use the double equals == to test for equality.

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

Sidebar

Related Questions

I just finished programming a plattform on PHP that uses MySQL to save the
Just finished a little app that I want to distribute and at the moment
i just finished my first view in my iPhone app and i want to
I just finished an app that synchronizes its data with a server (runs SyncAdapter
Just finished reading this blog post: http://www.skorks.com/2010/03/an-interview-question-that-prints-out-its-own-source-code-in-ruby/ In it, the author argues the case
Just finished up my first mvc4 app. Everything is working great until I deploy
I just finished a project for my cryptography class and it all seems to
I just finished a database layer based on redis that offers to select between
Just finished incorporating PHP_Beautifier into Vim and the fact that it removes whitespace irks
I just finished writing a function that has ended up with nested code blocks

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.