Skip to content

Instantly share code, notes, and snippets.

@jasonmcdermott
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonmcdermott/1b96032b879c40d9ec2f to your computer and use it in GitHub Desktop.
Save jasonmcdermott/1b96032b879c40d9ec2f to your computer and use it in GitHub Desktop.
//
// 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