Ok im a little stuck regarding this. My question is I have the application with two buttons that does add and subtract with the numbers displayed on a label. The question I'm having is when a certain number is displayed on the label, lets say 22, the phone vibrates only on 22.
Here is my code so far, thank you for the help!
StartCountViewController.M
StartCountViewController.M
Here is my code so far, thank you for the help!
StartCountViewController.M
Code:
#import "StartCountViewController.h"
@implementation StartCountViewController
int Count=0;
-(void)awakeFromNib {
startCount.text = @"0";
}
- (IBAction)addNumber {
if(Count >= 999) return;
NSString *numValue = [[NSString alloc] initWithFormat:@"%d", Count++];
startCount.text = numValue;
[numValue release];
}
- (IBAction)subtractNumber {
if(Count <= 0) return;
NSString *numValue = [[NSString alloc] initWithFormat:@"%d", Count--];
startCount.text = numValue;
[numValue release];
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
@end
StartCountViewController.M
Code:
#import <UIKit/UIKit.h>
@interface StartCountViewController : UIViewController {
IBOutlet UILabel *startCount;
}
//@property(nonatomic, retain) UILabel *startCount;
- (IBAction)addNumber;
- (IBAction)subtractNumber;
@end