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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:50:17+00:00 2026-06-01T00:50:17+00:00

HERE IS THE CODE: http://min.us/mWdMO0n14 I’m a Obj C newbie, so I’ve searched quite

  • 0

HERE IS THE CODE: http://min.us/mWdMO0n14

I’m a Obj C newbie, so I’ve searched quite a bit, but haven’t found anything that can solve my problem.

I have CalculatorViewController.h and .m and then CalculatorBrain.h and.m (Stanford Lectures)

in CalculatorBrain.m, I have the following method, with all of the variables defined as private in the CalculatorBrain header.

- (void)clearEverythingOnShakeGesture{
    operand = 0;
    waitingOperation = @"";
    waitingOperand = 0;
}

Then in CalculatorBrain.m , I have everything set up to detect shakes, as follows. I’ve included some of the code above the shake detection just so you have a general idea.

@interface CalculatorViewController()
@property(nonatomic, retain) CalculatorBrain *brain;
@end

@implementation CalculatorViewController

@synthesize brain;
- (CalculatorBrain *)brain {
    if (!brain) {
        brain = [[CalculatorBrain alloc] init];
    }
    return brain;
}

-(BOOL)canBecomeFirstResponder{
    return YES;
}

-(void)viewDidAppear: (BOOL) animated{
    [super viewDidAppear:animated];
    [self becomeFirstResponder]; 
}

- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
    if (event.subtype == UIEventSubtypeMotionShake)
    {
        NSLog(@"SHAKE IT!");
        [brain clearEverythingOnShakeGesture]; //********** not sure how to call this.

    }
}

I’m not sure how to call [brain clearEverythingOnShakeGesture]; , because I get the error “Class method +clearEverythingOnShakeGesture not found, defaults to return type id”. However, if I make it a class method, the variables inside are instance variables, which provides another error. Any help greatly appreciated.

  • 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-01T00:50:18+00:00Added an answer on June 1, 2026 at 12:50 am

    The project’s AppDelegate posted in the comment above is building the calculator view controller from a nib, then releasing it immediately. The app functions partially, but the UILabel property to be cleared on the shake gesture is nulled at that point.

    Also, it’s a good practice to declare private properties in the private category, synthesize them with _underscore aliases, and refer to them as self.property outside of synthesized methods.

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

Sidebar

Related Questions

here is the code: http://jsfiddle.net/VW8V5/1/ When hover it should start looping but end of
See here for code: http://jsfiddle.net/ecFBK/10/ I'm having a hard time getting this to work
Here's my code : http://jsfiddle.net/d6j6e/ When you click on the gray little rectangle in
here is the code: http://jsfiddle.net/bfQMD/11/ Im using flip pluging and how to change opacity.
here is the code: http://jsfiddle.net/hQnXm/7/ So basically i need when hover, it should animate
here is the code: http://jsfiddle.net/4WyPq/ So basically when I click 'button1' it animates then
here is the code: http://jsfiddle.net/duNHJ/2/ Basically there is an animations every div so when
I'm using simple jcarousel here is ther code: http://jsfiddle.net/w6fLA/ I'm trying to show div
I'm using this plugin and here is the code: http://jsfiddle.net/gm8t5/ Basically I want to
I am trying to use the jQuery CSV plugin, as documented here: http://code.google.com/p/js-tables/wiki/CSV According

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.