Last active
August 29, 2015 14:03
-
-
Save jasonmcdermott/1b96032b879c40d9ec2f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CCHelper.m | |
// jason-wednesday | |
// | |
// Created by codeCamp on 9/07/2014. | |
// Copyright (c) 2014 codeCamp. All rights reserved. | |
// | |
#import "CCHelper.h" | |
@implementation CCHelper | |
+ (int)getHighScore | |
{ | |
int highScore = [[[NSUserDefaults standardUserDefaults] objectForKey:@"highScore"] intValue]; | |
NSLog(@"The high score is %d",highScore); | |
return highScore; | |
} | |
+ (void)setHighScore:(int)score | |
{ | |
[[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInt:score] forKey:@"highScore"]; | |
[[NSUserDefaults standardUserDefaults] synchronize]; | |
NSLog(@"Saved high score: %d",score); | |
} | |
+ (void)setLabel:(UILabel*)label textValue:(NSString *)text | |
{ | |
label.text = [NSString stringWithFormat:@"%@",text]; | |
} | |
+ (int)getRandomIntInRange:(int)upperLimit | |
{ | |
int colourNumber = abs((int)arc4random() % upperLimit); | |
return colourNumber; | |
} | |
+ (float)getRandomFloatInRange:(int)upperLimit | |
{ | |
float colourNumber = abs(arc4random() % upperLimit); | |
return colourNumber; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment