Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 4 files changed
  • 0 comments
  • 1 contributor
BIN  StopWatch.xcodeproj/project.xcworkspace/xcuserdata/nikhgupta.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown
2  StopWatch/AppDelegate.h
@@ -14,7 +14,7 @@
14 14 @property (strong, nonatomic) NSTimer *timer;
15 15 @property (weak) IBOutlet NSWindow *window;
16 16 @property (weak) IBOutlet NSTextField *labelField;
17   -@property (weak) IBOutlet NSButton *stopButton;
  17 +@property (weak) IBOutlet NSButton *pauseButton;
18 18 @property (weak) IBOutlet NSButton *startButton;
19 19
20 20 - (IBAction)start:(id)sender;
13 StopWatch/AppDelegate.m
@@ -13,7 +13,7 @@ @implementation AppDelegate
13 13 - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
14 14 {
15 15 // on app start, we want to show the stop button as disabled.
16   - [self.stopButton setEnabled:NO];
  16 + [self.pauseButton setEnabled:NO];
17 17 }
18 18
19 19 - (IBAction)start:(id)sender {
@@ -25,10 +25,13 @@ - (IBAction)start:(id)sender {
25 25 [self.startButton setTitle:@"Restart"];
26 26
27 27 // and, enable the pause/resume button.
28   - [self.stopButton setEnabled:YES];
  28 + [self.pauseButton setEnabled:YES];
29 29
30 30 // and, make sure that that button says 'Pause'
31   - [self.stopButton setNextState];
  31 + [self.pauseButton setNextState];
  32 + [self.pauseButton setKeyEquivalent:@"\r"];
  33 + // space bar should not fire any button
  34 + [self.window makeFirstResponder:nil];
32 35 }
33 36
34 37 - (IBAction)pauseOrResume:(id)sender {
@@ -38,11 +41,15 @@ - (IBAction)pauseOrResume:(id)sender {
38 41 self.timer = nil;
39 42 // and, enable the start button.
40 43 [self.startButton setEnabled:YES];
  44 + // make start button as the first responder
  45 + [self.window makeFirstResponder:self.startButton];
41 46 } else {
42 47 // when the user clicks resume, we resume the watch
43 48 [self startTimer :[self.labelField doubleValue]];
44 49 // and, disable the start button.
45 50 [self.startButton setEnabled:NO];
  51 + // make start button as the first responder
  52 + [self.window makeFirstResponder:nil];
46 53 }
47 54 }
48 55
95 StopWatch/en.lproj/MainMenu.xib
@@ -285,7 +285,6 @@
285 285 <int key="NSvFlags">268</int>
286 286 <string key="NSFrame">{{17, 49}, {246, 77}}</string>
287 287 <reference key="NSSuperview" ref="439893737"/>
288   - <reference key="NSWindow"/>
289 288 <reference key="NSNextKeyView" ref="798352336"/>
290 289 <string key="NSReuseIdentifierKey">_NS:1535</string>
291 290 <bool key="NSEnabled">YES</bool>
@@ -326,7 +325,6 @@
326 325 <int key="NSvFlags">268</int>
327 326 <string key="NSFrame">{{106, 13}, {70, 32}}</string>
328 327 <reference key="NSSuperview" ref="439893737"/>
329   - <reference key="NSWindow"/>
330 328 <reference key="NSNextKeyView" ref="185602977"/>
331 329 <string key="NSReuseIdentifierKey">_NS:9</string>
332 330 <bool key="NSEnabled">YES</bool>
@@ -355,7 +353,6 @@
355 353 <int key="NSvFlags">268</int>
356 354 <string key="NSFrame">{{176, 13}, {90, 32}}</string>
357 355 <reference key="NSSuperview" ref="439893737"/>
358   - <reference key="NSWindow"/>
359 356 <string key="NSReuseIdentifierKey">_NS:9</string>
360 357 <bool key="NSEnabled">YES</bool>
361 358 <object class="NSButtonCell" key="NSCell" id="1062390660">
@@ -378,7 +375,6 @@
378 375 </array>
379 376 <string key="NSFrameSize">{280, 146}</string>
380 377 <reference key="NSSuperview"/>
381   - <reference key="NSWindow"/>
382 378 <reference key="NSNextKeyView" ref="4328423"/>
383 379 </object>
384 380 <string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
@@ -514,6 +510,14 @@
514 510 </object>
515 511 <int key="connectionID">683</int>
516 512 </object>
  513 + <object class="IBConnectionRecord">
  514 + <object class="IBOutletConnection" key="connection">
  515 + <string key="label">pauseButton</string>
  516 + <reference key="source" ref="976324537"/>
  517 + <reference key="destination" ref="185602977"/>
  518 + </object>
  519 + <int key="connectionID">685</int>
  520 + </object>
517 521 </array>
518 522 <object class="IBMutableOrderedSet" key="objectRecords">
519 523 <array key="orderedObjects">
@@ -755,7 +759,7 @@
755 759 <float key="scoringTypeFloat">29</float>
756 760 <int key="contentType">3</int>
757 761 </object>
758   - <object class="IBNSLayoutConstraint" id="996147501">
  762 + <object class="IBNSLayoutConstraint" id="166409469">
759 763 <reference key="firstItem" ref="439893737"/>
760 764 <int key="firstAttribute">4</int>
761 765 <int key="relation">0</int>
@@ -803,7 +807,7 @@
803 807 <float key="scoringTypeFloat">29</float>
804 808 <int key="contentType">3</int>
805 809 </object>
806   - <object class="IBNSLayoutConstraint" id="961362344">
  810 + <object class="IBNSLayoutConstraint" id="491937852">
807 811 <reference key="firstItem" ref="439893737"/>
808 812 <int key="firstAttribute">6</int>
809 813 <int key="relation">0</int>
@@ -888,7 +892,7 @@
888 892 </object>
889 893 <object class="IBObjectRecord">
890 894 <int key="objectID">649</int>
891   - <reference key="object" ref="961362344"/>
  895 + <reference key="object" ref="491937852"/>
892 896 <reference key="parent" ref="439893737"/>
893 897 </object>
894 898 <object class="IBObjectRecord">
@@ -913,7 +917,7 @@
913 917 </object>
914 918 <object class="IBObjectRecord">
915 919 <int key="objectID">681</int>
916   - <reference key="object" ref="996147501"/>
  920 + <reference key="object" ref="166409469"/>
917 921 <reference key="parent" ref="439893737"/>
918 922 </object>
919 923 <object class="IBObjectRecord">
@@ -948,10 +952,10 @@
948 952 <string key="371.IBWindowTemplateEditedContentRect">{{380, 496}, {480, 360}}</string>
949 953 <integer value="1" key="371.NSWindowTemplate.visibleAtLaunch"/>
950 954 <array class="NSMutableArray" key="372.IBNSViewMetadataConstraints">
951   - <reference ref="961362344"/>
  955 + <reference ref="491937852"/>
952 956 <reference ref="930020361"/>
953 957 <reference ref="440470530"/>
954   - <reference ref="996147501"/>
  958 + <reference ref="166409469"/>
955 959 <reference ref="301461393"/>
956 960 <reference ref="153067597"/>
957 961 <reference ref="225315202"/>
@@ -988,76 +992,9 @@
988 992 <nil key="activeLocalization"/>
989 993 <dictionary class="NSMutableDictionary" key="localizations"/>
990 994 <nil key="sourceID"/>
991   - <int key="maxID">684</int>
992   - </object>
993   - <object class="IBClassDescriber" key="IBDocument.Classes">
994   - <array class="NSMutableArray" key="referencedPartialClassDescriptions">
995   - <object class="IBPartialClassDescription">
996   - <string key="className">AppDelegate</string>
997   - <string key="superclassName">NSObject</string>
998   - <dictionary class="NSMutableDictionary" key="actions">
999   - <string key="pauseOrResume:">id</string>
1000   - <string key="performZoom:">id</string>
1001   - <string key="start:">id</string>
1002   - </dictionary>
1003   - <dictionary class="NSMutableDictionary" key="actionInfosByName">
1004   - <object class="IBActionInfo" key="pauseOrResume:">
1005   - <string key="name">pauseOrResume:</string>
1006   - <string key="candidateClassName">id</string>
1007   - </object>
1008   - <object class="IBActionInfo" key="performZoom:">
1009   - <string key="name">performZoom:</string>
1010   - <string key="candidateClassName">id</string>
1011   - </object>
1012   - <object class="IBActionInfo" key="start:">
1013   - <string key="name">start:</string>
1014   - <string key="candidateClassName">id</string>
1015   - </object>
1016   - </dictionary>
1017   - <dictionary class="NSMutableDictionary" key="outlets">
1018   - <string key="labelField">NSTextField</string>
1019   - <string key="mainView">NSView</string>
1020   - <string key="startButton">NSButton</string>
1021   - <string key="stopButton">NSButton</string>
1022   - <string key="window">NSWindow</string>
1023   - </dictionary>
1024   - <dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
1025   - <object class="IBToOneOutletInfo" key="labelField">
1026   - <string key="name">labelField</string>
1027   - <string key="candidateClassName">NSTextField</string>
1028   - </object>
1029   - <object class="IBToOneOutletInfo" key="mainView">
1030   - <string key="name">mainView</string>
1031   - <string key="candidateClassName">NSView</string>
1032   - </object>
1033   - <object class="IBToOneOutletInfo" key="startButton">
1034   - <string key="name">startButton</string>
1035   - <string key="candidateClassName">NSButton</string>
1036   - </object>
1037   - <object class="IBToOneOutletInfo" key="stopButton">
1038   - <string key="name">stopButton</string>
1039   - <string key="candidateClassName">NSButton</string>
1040   - </object>
1041   - <object class="IBToOneOutletInfo" key="window">
1042   - <string key="name">window</string>
1043   - <string key="candidateClassName">NSWindow</string>
1044   - </object>
1045   - </dictionary>
1046   - <object class="IBClassDescriptionSource" key="sourceIdentifier">
1047   - <string key="majorKey">IBProjectSource</string>
1048   - <string key="minorKey">./Classes/AppDelegate.h</string>
1049   - </object>
1050   - </object>
1051   - <object class="IBPartialClassDescription">
1052   - <string key="className">NSLayoutConstraint</string>
1053   - <string key="superclassName">NSObject</string>
1054   - <object class="IBClassDescriptionSource" key="sourceIdentifier">
1055   - <string key="majorKey">IBProjectSource</string>
1056   - <string key="minorKey">./Classes/NSLayoutConstraint.h</string>
1057   - </object>
1058   - </object>
1059   - </array>
  995 + <int key="maxID">685</int>
1060 996 </object>
  997 + <object class="IBClassDescriber" key="IBDocument.Classes"/>
1061 998 <int key="IBDocument.localizationMode">0</int>
1062 999 <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
1063 1000 <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>

No commit comments for this range

Something went wrong with that request. Please try again.