Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: nikhgupta/StopWatch
base: fe3f5e5b98
...
head fork: nikhgupta/StopWatch
compare: 20d9014ad4
  • 2 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
BIN  StopWatch.xcodeproj/project.xcworkspace/xcuserdata/nikhgupta.xcuserdatad/UserInterfaceState.xcuserstate
View
Binary file not shown
2  StopWatch/AppDelegate.h
View
@@ -14,7 +14,7 @@
@property (strong, nonatomic) NSTimer *timer;
@property (weak) IBOutlet NSWindow *window;
@property (weak) IBOutlet NSTextField *labelField;
-@property (weak) IBOutlet NSButton *stopButton;
+@property (weak) IBOutlet NSButton *pauseButton;
@property (weak) IBOutlet NSButton *startButton;
- (IBAction)start:(id)sender;
13 StopWatch/AppDelegate.m
View
@@ -13,7 +13,7 @@ @implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// on app start, we want to show the stop button as disabled.
- [self.stopButton setEnabled:NO];
+ [self.pauseButton setEnabled:NO];
}
- (IBAction)start:(id)sender {
@@ -25,10 +25,13 @@ - (IBAction)start:(id)sender {
[self.startButton setTitle:@"Restart"];
// and, enable the pause/resume button.
- [self.stopButton setEnabled:YES];
+ [self.pauseButton setEnabled:YES];
// and, make sure that that button says 'Pause'
- [self.stopButton setNextState];
+ [self.pauseButton setNextState];
+ [self.pauseButton setKeyEquivalent:@"\r"];
+ // space bar should not fire any button
+ [self.window makeFirstResponder:nil];
}
- (IBAction)pauseOrResume:(id)sender {
@@ -38,11 +41,15 @@ - (IBAction)pauseOrResume:(id)sender {
self.timer = nil;
// and, enable the start button.
[self.startButton setEnabled:YES];
+ // make start button as the first responder
+ [self.window makeFirstResponder:self.startButton];
} else {
// when the user clicks resume, we resume the watch
[self startTimer :[self.labelField doubleValue]];
// and, disable the start button.
[self.startButton setEnabled:NO];
+ // make start button as the first responder
+ [self.window makeFirstResponder:nil];
}
}
95 StopWatch/en.lproj/MainMenu.xib
View
@@ -285,7 +285,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{17, 49}, {246, 77}}</string>
<reference key="NSSuperview" ref="439893737"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="798352336"/>
<string key="NSReuseIdentifierKey">_NS:1535</string>
<bool key="NSEnabled">YES</bool>
@@ -326,7 +325,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{106, 13}, {70, 32}}</string>
<reference key="NSSuperview" ref="439893737"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="185602977"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
@@ -355,7 +353,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{176, 13}, {90, 32}}</string>
<reference key="NSSuperview" ref="439893737"/>
- <reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="1062390660">
@@ -378,7 +375,6 @@
</array>
<string key="NSFrameSize">{280, 146}</string>
<reference key="NSSuperview"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="4328423"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
@@ -514,6 +510,14 @@
</object>
<int key="connectionID">683</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">pauseButton</string>
+ <reference key="source" ref="976324537"/>
+ <reference key="destination" ref="185602977"/>
+ </object>
+ <int key="connectionID">685</int>
+ </object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
@@ -755,7 +759,7 @@
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
</object>
- <object class="IBNSLayoutConstraint" id="996147501">
+ <object class="IBNSLayoutConstraint" id="166409469">
<reference key="firstItem" ref="439893737"/>
<int key="firstAttribute">4</int>
<int key="relation">0</int>
@@ -803,7 +807,7 @@
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
</object>
- <object class="IBNSLayoutConstraint" id="961362344">
+ <object class="IBNSLayoutConstraint" id="491937852">
<reference key="firstItem" ref="439893737"/>
<int key="firstAttribute">6</int>
<int key="relation">0</int>
@@ -888,7 +892,7 @@
</object>
<object class="IBObjectRecord">
<int key="objectID">649</int>
- <reference key="object" ref="961362344"/>
+ <reference key="object" ref="491937852"/>
<reference key="parent" ref="439893737"/>
</object>
<object class="IBObjectRecord">
@@ -913,7 +917,7 @@
</object>
<object class="IBObjectRecord">
<int key="objectID">681</int>
- <reference key="object" ref="996147501"/>
+ <reference key="object" ref="166409469"/>
<reference key="parent" ref="439893737"/>
</object>
<object class="IBObjectRecord">
@@ -948,10 +952,10 @@
<string key="371.IBWindowTemplateEditedContentRect">{{380, 496}, {480, 360}}</string>
<integer value="1" key="371.NSWindowTemplate.visibleAtLaunch"/>
<array class="NSMutableArray" key="372.IBNSViewMetadataConstraints">
- <reference ref="961362344"/>
+ <reference ref="491937852"/>
<reference ref="930020361"/>
<reference ref="440470530"/>
- <reference ref="996147501"/>
+ <reference ref="166409469"/>
<reference ref="301461393"/>
<reference ref="153067597"/>
<reference ref="225315202"/>
@@ -988,76 +992,9 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
- <int key="maxID">684</int>
- </object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <array class="NSMutableArray" key="referencedPartialClassDescriptions">
- <object class="IBPartialClassDescription">
- <string key="className">AppDelegate</string>
- <string key="superclassName">NSObject</string>
- <dictionary class="NSMutableDictionary" key="actions">
- <string key="pauseOrResume:">id</string>
- <string key="performZoom:">id</string>
- <string key="start:">id</string>
- </dictionary>
- <dictionary class="NSMutableDictionary" key="actionInfosByName">
- <object class="IBActionInfo" key="pauseOrResume:">
- <string key="name">pauseOrResume:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo" key="performZoom:">
- <string key="name">performZoom:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo" key="start:">
- <string key="name">start:</string>
- <string key="candidateClassName">id</string>
- </object>
- </dictionary>
- <dictionary class="NSMutableDictionary" key="outlets">
- <string key="labelField">NSTextField</string>
- <string key="mainView">NSView</string>
- <string key="startButton">NSButton</string>
- <string key="stopButton">NSButton</string>
- <string key="window">NSWindow</string>
- </dictionary>
- <dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
- <object class="IBToOneOutletInfo" key="labelField">
- <string key="name">labelField</string>
- <string key="candidateClassName">NSTextField</string>
- </object>
- <object class="IBToOneOutletInfo" key="mainView">
- <string key="name">mainView</string>
- <string key="candidateClassName">NSView</string>
- </object>
- <object class="IBToOneOutletInfo" key="startButton">
- <string key="name">startButton</string>
- <string key="candidateClassName">NSButton</string>
- </object>
- <object class="IBToOneOutletInfo" key="stopButton">
- <string key="name">stopButton</string>
- <string key="candidateClassName">NSButton</string>
- </object>
- <object class="IBToOneOutletInfo" key="window">
- <string key="name">window</string>
- <string key="candidateClassName">NSWindow</string>
- </object>
- </dictionary>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/AppDelegate.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSLayoutConstraint</string>
- <string key="superclassName">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/NSLayoutConstraint.h</string>
- </object>
- </object>
- </array>
+ <int key="maxID">685</int>
</object>
+ <object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>

No commit comments for this range

Something went wrong with that request. Please try again.