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
// Note this snippet requires AFNetworking v2.x | |
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; | |
manager.securityPolicy.allowInvalidCertificates = YES; | |
manager.requestSerializer = [AFJSONRequestSerializer serializer]; | |
NSMutableDictionary *result = [[NSMutableDictionary alloc] init]; | |
result[@"username"] = @"JohnSmith"; | |
result[@"email"] = @"[email protected]"; | |
result[@"phone"] = @"06543213131"; | |
result[@"name"] = @"John Smith"; |
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
// assumes object class called SENQuestionnaire | |
- (void)writeDictionaryToDisk:(SENQuestionnaire *)q | |
{ | |
NSDictionary *dataDictionary = | |
@{ | |
@"stringA" : @"string A", | |
@"stringB" : @"string B", | |
@"stringC" : @"string C", |
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
- (PdAudioStatus)configurePlaybackWithSampleRate:(int)sampleRate | |
numberChannels:(int)numChannels | |
inputEnabled:(BOOL)inputEnabled | |
mixingEnabled:(BOOL)mixingEnabled | |
ambientEnabled:(BOOL)ambientEnabled { | |
PdAudioStatus status = PdAudioOK; | |
if (inputEnabled && ![[AVAudioSession sharedInstance] inputIsAvailable]) { | |
inputEnabled = NO; | |
status |= PdAudioPropertyChanged; |
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.h | |
// jason-wednesday | |
// | |
// Created by codeCamp on 9/07/2014. | |
// Copyright (c) 2014 codeCamp. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
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" |
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
#import "CCViewController.h" | |
@interface CCViewController () | |
{ | |
int score,lives,highScore,timeLeft; | |
BOOL playing; | |
} | |
@property (weak, nonatomic) IBOutlet UIButton *hitMeButton; | |
@property (weak, nonatomic) IBOutlet UIButton *loseLifeButton; |
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
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
// do any additional... | |
UITapGestureRecognizer *gestureRecogniser = | |
[[UITapGestureRecognizer alloc] initWithTarget:self | |
action:@selector(handleTap:)]; | |
gestureRecogniser.numberOfTapsRequired = 1; |
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
- (void)endGame | |
{ | |
if (playing) { | |
playing = NO; | |
[self hideButton]; | |
[self.playPauseButton setTitle:@"Play" forState:UIControlStateNormal]; | |
if (score > highScore) { | |
highScore = score; |
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
- (void)handleTap:(UIGestureRecognizer*)tap { | |
if (playing) { | |
// score--; | |
[self updateLabels]; | |
if (score < 0) { | |
[self endGame]; | |
} | |
} | |
} |
NewerOlder