Skip to content

Instantly share code, notes, and snippets.

@jasonmcdermott

jasonmcdermott/CCHelper.m

Last active Aug 29, 2015
Embed
What would you like to do?
//
// 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
You can’t perform that action at this time.