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

I found a code samples here: http://sturla.simnet.is/post/2008/09/22/Enable-proxy-in-IE.aspx But it's very complex and involves manipulating
I found this code from here: http://www.cssportal.com/form-elements/text-box.htm But the problem is you can still
I am trying to get the code found here: http://snipplr.com/view/26643/mbprogresshud-with-an-asynchronous-nsurlconnection-call/ to work in my
I'm using an HTML sanitizing whitelist code found here: http://refactormycode.com/codes/333-sanitize-html I needed to add
Basically my problem is that i've adapted a piece of code found here http://social.msdn.microsoft.com/Forums/en-US/vemapcontroldev/thread/62e70670-f306-4bb7-8684-549979af91c1
See here: http://code.google.com/p/ie7-js/ Does anyone have any experience or remarks about this javascript? Is
I am trying to test some of these code here http://ha.ckers.org/xss.html on my code.
Hey I have this code right here: http://pastie.org/534470 And on line 109 I get
I'm using cocoa JSON framework http://code.google.com/p/json-framework/ Here is the result of an JSON output
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.