Skip to content

Lauren + Christian final project #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
14 changes: 14 additions & 0 deletions Time/StopwatchViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// StopwatchViewController.h
// Time
//
// Created by Lauren Caponong on 8/22/15.
// Copyright (c) 2015 Mike Kavouras. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface StopwatchViewController : UIViewController


@end
134 changes: 134 additions & 0 deletions Time/StopwatchViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
//
// StopwatchViewController.m
// Time
//
// Created by Lauren Caponong on 8/22/15.
// Copyright (c) 2015 Mike Kavouras. All rights reserved.
//

#import "StopwatchViewController.h"

@interface StopwatchViewController () <UITableViewDataSource, UITableViewDelegate>

@property (weak, nonatomic) IBOutlet UILabel *stopwatchTimerLabel;

@property (weak, nonatomic) IBOutlet UIButton *startButtonTapped;
@property (weak, nonatomic) IBOutlet UIButton *pauseButtonTapped;
@property (weak, nonatomic) IBOutlet UIButton *lapButtonTapped;

@property (weak, nonatomic) IBOutlet UIButton *resetButtonTapped;


@property (nonatomic) float nextNumber;
@property (nonatomic) float currentNumber;

@property (nonatomic) NSTimer *timer1;

@property (weak, nonatomic) IBOutlet UITableView *lapsTableView;
@property (nonatomic) NSMutableArray *laps;
@property (nonatomic) float currentLapTime;

@end




@implementation StopwatchViewController

- (void)viewDidLoad {
[super viewDidLoad];

self.laps = [[NSMutableArray alloc] init];
self.lapsTableView.dataSource = self;



}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

/*
#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.
}
*/

- (IBAction)startButtonTapped:(id)sender {

[self.timer1 invalidate];

self.timer1 = [NSTimer scheduledTimerWithTimeInterval:0.001 target:self selector:@selector(startButtonTapped:) userInfo:nil repeats:NO];

float currentNumber = [self.stopwatchTimerLabel.text floatValue];
self.nextNumber = currentNumber + 0.001;
self.stopwatchTimerLabel.text = [NSString stringWithFormat:@"%lf", self.nextNumber];

}


- (IBAction)pauseButtonTapped:(id)sender {

[self.timer1 invalidate];




}


- (IBAction)lapButtonTapped:(id)sender {

NSString *currentLapTime = self.stopwatchTimerLabel.text;

[self.laps addObject:currentLapTime];

[self.lapsTableView reloadData];

}




- (IBAction)resetButtonTapped:(id)sender {

[self.timer1 invalidate];

self.currentNumber = 0;
self.stopwatchTimerLabel.text = [NSString stringWithFormat:@"--"];

[self.laps removeAllObjects];
[self.lapsTableView reloadData];

}



- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.laps.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LapCellIdentifier" forIndexPath:indexPath];

cell.textLabel.text = self.laps[indexPath.row];

cell.detailTextLabel.text = [NSString stringWithFormat:@"Lap %ld", (long)indexPath.row];

return cell;
}



@end
74 changes: 68 additions & 6 deletions Time/Time.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,22 @@
objects = {

/* Begin PBXBuildFile section */
89060FBB1B94B04E005C707A /* UpcomingEventsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 89060FBA1B94B04E005C707A /* UpcomingEventsTableViewController.m */; };
89060FBE1B94B47C005C707A /* UpcomingEvents.m in Sources */ = {isa = PBXBuildFile; fileRef = 89060FBD1B94B47C005C707A /* UpcomingEvents.m */; };
892D1E9D1B97D8630039EA41 /* AnotherEventViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 892D1E9C1B97D8630039EA41 /* AnotherEventViewController.m */; };
89C909871B88DB5800216084 /* StopwatchViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 89C909861B88DB5800216084 /* StopwatchViewController.m */; };
89FD9A441B86AC7500D7A645 /* TimerUITabBarController.m in Sources */ = {isa = PBXBuildFile; fileRef = 89FD9A431B86AC7500D7A645 /* TimerUITabBarController.m */; };
89FD9A471B86B55600D7A645 /* PresetTimersViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 89FD9A461B86B55600D7A645 /* PresetTimersViewController.m */; };
89FD9A4D1B86B58900D7A645 /* SpecialEventsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 89FD9A4C1B86B58900D7A645 /* SpecialEventsViewController.m */; };
8D05375E1B86687C00588318 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D05375D1B86687C00588318 /* main.m */; };
8D0537611B86687C00588318 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D0537601B86687C00588318 /* AppDelegate.m */; };
8D0537641B86687C00588318 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D0537631B86687C00588318 /* ViewController.m */; };
8D0537671B86687C00588318 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8D0537651B86687C00588318 /* Main.storyboard */; };
8D0537691B86687C00588318 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8D0537681B86687C00588318 /* Images.xcassets */; };
8D05376C1B86687C00588318 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8D05376A1B86687C00588318 /* LaunchScreen.xib */; };
8D0537781B86687C00588318 /* TimeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D0537771B86687C00588318 /* TimeTests.m */; };
EB7C5AA31B97BA5100F86122 /* AnotherEventTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EB7C5AA21B97BA5100F86122 /* AnotherEventTableViewController.m */; };
EB9EE0951B8E803500DB27D1 /* NewCustomTimerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EB9EE0941B8E803500DB27D1 /* NewCustomTimerViewController.m */; };
EB9EE1791B96519900DB27D1 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EB9EE1781B96519900DB27D1 /* AudioToolbox.framework */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -27,26 +36,44 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
89060FB91B94B04E005C707A /* UpcomingEventsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UpcomingEventsTableViewController.h; sourceTree = "<group>"; };
89060FBA1B94B04E005C707A /* UpcomingEventsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UpcomingEventsTableViewController.m; sourceTree = "<group>"; };
89060FBC1B94B47C005C707A /* UpcomingEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UpcomingEvents.h; sourceTree = "<group>"; };
89060FBD1B94B47C005C707A /* UpcomingEvents.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UpcomingEvents.m; sourceTree = "<group>"; };
892D1E9B1B97D8630039EA41 /* AnotherEventViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnotherEventViewController.h; sourceTree = "<group>"; };
892D1E9C1B97D8630039EA41 /* AnotherEventViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AnotherEventViewController.m; sourceTree = "<group>"; };
89C909851B88DB5800216084 /* StopwatchViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StopwatchViewController.h; path = ../StopwatchViewController.h; sourceTree = "<group>"; };
89C909861B88DB5800216084 /* StopwatchViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = StopwatchViewController.m; path = ../StopwatchViewController.m; sourceTree = "<group>"; };
89FD9A421B86AC7500D7A645 /* TimerUITabBarController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimerUITabBarController.h; sourceTree = SOURCE_ROOT; };
89FD9A431B86AC7500D7A645 /* TimerUITabBarController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TimerUITabBarController.m; sourceTree = SOURCE_ROOT; };
89FD9A451B86B55600D7A645 /* PresetTimersViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PresetTimersViewController.h; sourceTree = "<group>"; };
89FD9A461B86B55600D7A645 /* PresetTimersViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PresetTimersViewController.m; sourceTree = "<group>"; };
89FD9A4B1B86B58900D7A645 /* SpecialEventsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpecialEventsViewController.h; sourceTree = "<group>"; };
89FD9A4C1B86B58900D7A645 /* SpecialEventsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SpecialEventsViewController.m; sourceTree = "<group>"; };
8D0537581B86687B00588318 /* Time.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Time.app; sourceTree = BUILT_PRODUCTS_DIR; };
8D05375C1B86687B00588318 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8D05375D1B86687C00588318 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
8D05375F1B86687C00588318 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
8D0537601B86687C00588318 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
8D0537621B86687C00588318 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
8D0537631B86687C00588318 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
8D0537661B86687C00588318 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
8D0537681B86687C00588318 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
8D05376B1B86687C00588318 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
8D0537711B86687C00588318 /* TimeTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TimeTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
8D0537761B86687C00588318 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8D0537771B86687C00588318 /* TimeTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TimeTests.m; sourceTree = "<group>"; };
EB7C5AA11B97BA5100F86122 /* AnotherEventTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnotherEventTableViewController.h; sourceTree = "<group>"; };
EB7C5AA21B97BA5100F86122 /* AnotherEventTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AnotherEventTableViewController.m; sourceTree = "<group>"; };
EB9EE0931B8E803500DB27D1 /* NewCustomTimerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NewCustomTimerViewController.h; sourceTree = "<group>"; };
EB9EE0941B8E803500DB27D1 /* NewCustomTimerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NewCustomTimerViewController.m; sourceTree = "<group>"; };
EB9EE1781B96519900DB27D1 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
8D0537551B86687B00588318 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
EB9EE1791B96519900DB27D1 /* AudioToolbox.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -60,9 +87,25 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
89060FB81B94B028005C707A /* OLD */ = {
isa = PBXGroup;
children = (
89060FB91B94B04E005C707A /* UpcomingEventsTableViewController.h */,
89060FBA1B94B04E005C707A /* UpcomingEventsTableViewController.m */,
EB7C5AA11B97BA5100F86122 /* AnotherEventTableViewController.h */,
EB7C5AA21B97BA5100F86122 /* AnotherEventTableViewController.m */,
89060FBC1B94B47C005C707A /* UpcomingEvents.h */,
89060FBD1B94B47C005C707A /* UpcomingEvents.m */,
89FD9A4B1B86B58900D7A645 /* SpecialEventsViewController.h */,
89FD9A4C1B86B58900D7A645 /* SpecialEventsViewController.m */,
);
name = OLD;
sourceTree = "<group>";
};
8D05374F1B86687B00588318 = {
isa = PBXGroup;
children = (
EB9EE1781B96519900DB27D1 /* AudioToolbox.framework */,
8D05375A1B86687B00588318 /* Time */,
8D0537741B86687C00588318 /* TimeTests */,
8D0537591B86687B00588318 /* Products */,
Expand All @@ -83,9 +126,18 @@
children = (
8D05375F1B86687C00588318 /* AppDelegate.h */,
8D0537601B86687C00588318 /* AppDelegate.m */,
8D0537621B86687C00588318 /* ViewController.h */,
8D0537631B86687C00588318 /* ViewController.m */,
8D0537651B86687C00588318 /* Main.storyboard */,
89FD9A421B86AC7500D7A645 /* TimerUITabBarController.h */,
89FD9A431B86AC7500D7A645 /* TimerUITabBarController.m */,
89FD9A451B86B55600D7A645 /* PresetTimersViewController.h */,
89FD9A461B86B55600D7A645 /* PresetTimersViewController.m */,
EB9EE0931B8E803500DB27D1 /* NewCustomTimerViewController.h */,
EB9EE0941B8E803500DB27D1 /* NewCustomTimerViewController.m */,
89C909851B88DB5800216084 /* StopwatchViewController.h */,
89C909861B88DB5800216084 /* StopwatchViewController.m */,
892D1E9B1B97D8630039EA41 /* AnotherEventViewController.h */,
892D1E9C1B97D8630039EA41 /* AnotherEventViewController.m */,
89060FB81B94B028005C707A /* OLD */,
8D0537681B86687C00588318 /* Images.xcassets */,
8D05376A1B86687C00588318 /* LaunchScreen.xib */,
8D05375B1B86687B00588318 /* Supporting Files */,
Expand Down Expand Up @@ -219,9 +271,17 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8D0537641B86687C00588318 /* ViewController.m in Sources */,
89FD9A441B86AC7500D7A645 /* TimerUITabBarController.m in Sources */,
EB9EE0951B8E803500DB27D1 /* NewCustomTimerViewController.m in Sources */,
89FD9A471B86B55600D7A645 /* PresetTimersViewController.m in Sources */,
89C909871B88DB5800216084 /* StopwatchViewController.m in Sources */,
89060FBB1B94B04E005C707A /* UpcomingEventsTableViewController.m in Sources */,
EB7C5AA31B97BA5100F86122 /* AnotherEventTableViewController.m in Sources */,
8D0537611B86687C00588318 /* AppDelegate.m in Sources */,
892D1E9D1B97D8630039EA41 /* AnotherEventViewController.m in Sources */,
8D05375E1B86687C00588318 /* main.m in Sources */,
89FD9A4D1B86B58900D7A645 /* SpecialEventsViewController.m in Sources */,
89060FBE1B94B47C005C707A /* UpcomingEvents.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -418,6 +478,7 @@
8D05377D1B86687C00588318 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
8D05377E1B86687C00588318 /* Build configuration list for PBXNativeTarget "TimeTests" */ = {
isa = XCConfigurationList;
Expand All @@ -426,6 +487,7 @@
8D0537801B86687C00588318 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
Expand Down
13 changes: 13 additions & 0 deletions Time/Time/AnotherEventTableViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// AnotherEventTableViewController.h
// Time
//
// Created by Christian Maldonado on 9/2/15.
// Copyright (c) 2015 Mike Kavouras. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface AnotherEventTableViewController : UITableViewController

@end
Loading