Skip to content

Commit

Permalink
added clr button to clear calculator label
Browse files Browse the repository at this point in the history
  • Loading branch information
NiFa18 committed Jan 25, 2013
1 parent dba88f1 commit f060466
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
4 changes: 4 additions & 0 deletions Calculator/CalculatorViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,8 @@ - (IBAction)operationPressed:(UIButton *)sender
NSString *resultString = [NSString stringWithFormat:@"%g", result];
self.display.text = resultString;
}
- (IBAction)clear
{
self.display.text = [NSString stringWithFormat:@"0"];
}
@end
36 changes: 30 additions & 6 deletions Calculator/en.lproj/MainStoryboard.storyboard
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="1.1" toolsVersion="2182" systemVersion="11D50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="2">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="2840" systemVersion="12C3006" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="2">
<dependencies>
<deployment defaultVersion="1296" identifier="iOS"/>
<development defaultVersion="4200" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="1181"/>
<deployment defaultVersion="1536" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="1926"/>
</dependencies>
<scenes>
<!--Calculator View Controller-->
<scene sceneID="5">
<objects>
<placeholder placeholderIdentifier="IBFirstResponder" id="4" sceneMemberID="firstResponder"/>
<viewController id="2" customClass="CalculatorViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="3">
<rect key="frame" x="0.0" y="20" width="320" height="460"/>
Expand Down Expand Up @@ -262,17 +260,43 @@
<action selector="enterPressed" destination="2" eventType="touchUpInside" id="Y97-RF-QdQ"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="m7p-Ee-Mzo">
<rect key="frame" x="128" y="246" width="64" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<state key="normal" title="clr">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="clear" destination="2" eventType="touchUpInside" id="Sth-Eq-ruE"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<connections>
<outlet property="display" destination="WHd-wC-a8F" id="x94-1V-EII"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="4" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="56" y="-98"/>
<point key="canvasLocation" x="241" y="397"/>
</scene>
</scenes>
<classes>
<class className="CalculatorViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/CalculatorViewController.h"/>
<relationships>
<relationship kind="action" name="digitPressed:" candidateClass="UIButton"/>
<relationship kind="action" name="operationPressed:" candidateClass="UIButton"/>
<relationship kind="outlet" name="display" candidateClass="UILabel"/>
</relationships>
</class>
</classes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
Expand Down

0 comments on commit f060466

Please sign in to comment.