Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,155 changes: 848 additions & 307 deletions HeadsUpper/HeadsUpper.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

112 changes: 102 additions & 10 deletions HeadsUpper/HeadsUpper/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,25 +1,117 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="ZoO-o1-5Ui">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<!--Game Topics Table View Controller-->
<scene sceneID="XcI-o8-SJY">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
<tableViewController id="46v-x1-8TK" customClass="gameTopicsTableViewController" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="w2z-xf-soB">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="topicsCellID" textLabel="a29-JK-Pr3" detailTextLabel="gb1-Nu-NoU" style="IBUITableViewCellStyleValue1" id="ifm-G3-Nqq">
<rect key="frame" x="0.0" y="92" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="ifm-G3-Nqq" id="8AF-Kp-eDx">
<rect key="frame" x="0.0" y="0.0" width="567" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="a29-JK-Pr3">
<rect key="frame" x="15" y="12" width="32" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Detail" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="gb1-Nu-NoU">
<rect key="frame" x="523" y="12" width="42" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.55686274509803924" green="0.55686274509803924" blue="0.57647058823529407" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<connections>
<segue destination="G8B-Mp-0Ub" kind="show" id="wVw-sg-I9S"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="46v-x1-8TK" id="C1l-Gy-VG4"/>
<outlet property="delegate" destination="46v-x1-8TK" id="2fg-YD-8GT"/>
</connections>
</tableView>
<navigationItem key="navigationItem" id="M61-Zj-OqQ"/>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="0gO-M7-JK6" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1014" y="180"/>
</scene>
<!--CluesVC-->
<scene sceneID="qAz-tl-rbq">
<objects>
<viewController storyboardIdentifier="clueVC" id="G8B-Mp-0Ub" customClass="CluesVC" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
<viewControllerLayoutGuide type="top" id="fgz-5E-YGj"/>
<viewControllerLayoutGuide type="bottom" id="7w8-Uh-ZF8"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<view key="view" contentMode="scaleToFill" id="SON-dT-ySz">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="RPl-ar-2w5">
<rect key="frame" x="254" y="277" width="92" height="46"/>
<fontDescription key="fontDescription" type="system" pointSize="38"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mbn-1u-h7F">
<rect key="frame" x="530" y="85" width="49" height="24"/>
<fontDescription key="fontDescription" type="system" pointSize="20"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="mbn-1u-h7F" secondAttribute="trailing" constant="21" id="0SK-Et-xKi"/>
<constraint firstItem="RPl-ar-2w5" firstAttribute="centerY" secondItem="SON-dT-ySz" secondAttribute="centerY" id="AbV-8p-K1A"/>
<constraint firstItem="mbn-1u-h7F" firstAttribute="top" secondItem="fgz-5E-YGj" secondAttribute="bottom" constant="21" id="HNE-Rs-UZz"/>
<constraint firstItem="RPl-ar-2w5" firstAttribute="centerX" secondItem="SON-dT-ySz" secondAttribute="centerX" id="qn1-NY-d3x"/>
</constraints>
</view>
<connections>
<outlet property="clueLabel" destination="RPl-ar-2w5" id="2Df-Pd-nuB"/>
<outlet property="timerLabel" destination="mbn-1u-h7F" id="56e-Sf-lvm"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="3HT-sl-HJR" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1640" y="180"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="Emx-a7-zNq">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="ZoO-o1-5Ui" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="ljx-r9-GTS">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="46v-x1-8TK" kind="relationship" relationship="rootViewController" id="vrJ-3U-Ys6"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Rt1-t4-eFs" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="340" y="180"/>
</scene>
</scenes>
</document>
13 changes: 13 additions & 0 deletions HeadsUpper/HeadsUpper/CluesVC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// CluesVC.h
// HeadsUpper
//
// Created by C4Q on 2/21/16.
// Copyright © 2016 Michael Kavouras. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface CluesVC : UIViewController
@property(nonatomic)NSArray *listClues;
@end
145 changes: 145 additions & 0 deletions HeadsUpper/HeadsUpper/CluesVC.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
//
// CluesVC.m
// HeadsUpper
//
// Created by C4Q on 2/21/16.
// Copyright © 2016 Michael Kavouras. All rights reserved.
//

#import "CluesVC.h"
#import <ChameleonFramework/Chameleon.h>
#import <SIAlertView/SIAlertView.h>

@interface CluesVC ()
@property (weak, nonatomic) IBOutlet UILabel *clueLabel;
@property (weak, nonatomic) IBOutlet UILabel *timerLabel;
@property (nonatomic)NSInteger timerCount;
@property (nonatomic) NSInteger rightCount;
@property (nonatomic) NSInteger answerNumber;
@property (nonatomic) NSInteger totalGuesses;
@end


@implementation CluesVC

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
self.answerNumber = 0;
self.rightCount = 0;
self.totalGuesses = 1;
self.clueLabel.text = self.listClues[self.answerNumber];

[self setupTimer];

}

# pragma mark - gesture methods
- (void) setUpGestureRecognizers {
UISwipeGestureRecognizer *leftSwipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)];
leftSwipe.direction= UISwipeGestureRecognizerDirectionLeft;

UISwipeGestureRecognizer *rightSwipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)];
rightSwipe.direction = UISwipeGestureRecognizerDirectionRight;



[self.view addGestureRecognizer:leftSwipe];
[self.view addGestureRecognizer:rightSwipe];

}

- (void) handleSwipe: (UISwipeGestureRecognizer *) gesture {
switch (gesture.direction) {
case UISwipeGestureRecognizerDirectionRight:
[self animateViewWith:[UIColor redColor]];
self.answerNumber++;
self.totalGuesses++;
self.clueLabel.text = self.listClues[self.answerNumber];

break;
case UISwipeGestureRecognizerDirectionLeft:
[self animateViewWith:[UIColor greenColor]];
self.rightCount++;
self.totalGuesses++;
self.answerNumber++;
self.clueLabel.text = self.listClues[self.answerNumber];
break;
default:
break;
}
}


-(void) animateViewWith:(UIColor* )color{
[UIView animateWithDuration:0.5
animations:^{
self.view.backgroundColor = color;
} completion:^(BOOL finished) {
self.view.backgroundColor = [UIColor whiteColor];
}];
}



//timer methods
-(void) setupTimer
{
self.timerCount = 10;
NSTimer *timer = [NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(handleGameTimer:) userInfo:nil repeats:YES];

[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
//[timer fire];
[self setUpGestureRecognizers];
}

- (void) handleGameTimer: (NSTimer * ) timer {


self.timerLabel.text = [NSString stringWithFormat: @"%ld", (long)self.timerCount];
self.timerCount--;

if (self.timerCount < 0 ) {
[timer invalidate];

//show score
NSString * endGameText = [NSString stringWithFormat:@"you got %ld out of %ld right", (long)self.rightCount, self.totalGuesses];
SIAlertView *alertView = [[SIAlertView alloc] initWithTitle:@"Game Over" andMessage:endGameText];

[alertView addButtonWithTitle:@"Play Again"
type:SIAlertViewButtonTypeDefault
handler:^(SIAlertView *alert) {

}];

alertView.didDismissHandler = ^(SIAlertView *alertView) {
[self dismissViewControllerAnimated:YES completion:nil];
};

alertView.transitionStyle = SIAlertViewTransitionStyleBounce;

[alertView show];


//end game

}

}






/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/

@end
19 changes: 19 additions & 0 deletions HeadsUpper/HeadsUpper/CluesVC.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="CluesVC">
<connections>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</objects>
</document>
15 changes: 0 additions & 15 deletions HeadsUpper/HeadsUpper/ViewController.h

This file was deleted.

27 changes: 0 additions & 27 deletions HeadsUpper/HeadsUpper/ViewController.m

This file was deleted.

13 changes: 13 additions & 0 deletions HeadsUpper/HeadsUpper/gameTopicsTableViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// gameTopicsTableViewController.h
// HeadsUpper
//
// Created by C4Q on 2/21/16.
// Copyright © 2016 Michael Kavouras. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface gameTopicsTableViewController : UITableViewController

@end
Loading