diff options
author | Eddie Ehlin <eddiex@eddiex.se> | 2012-12-29 02:21:33 +0100 |
---|---|---|
committer | Eddie Ehlin <eddiex@eddiex.se> | 2012-12-29 02:21:33 +0100 |
commit | ee4cbc12735a86d2a69f25f6678a2cb3df0de7e2 (patch) | |
tree | 2f4dac9c29e7e5d05f02c7505a299c3a5e75aadc /iBean/iBean | |
parent | 1ab920d1c14fc513be0333aee4a6f911188e1132 (diff) | |
download | iBean-ee4cbc12735a86d2a69f25f6678a2cb3df0de7e2.tar.gz iBean-ee4cbc12735a86d2a69f25f6678a2cb3df0de7e2.zip |
Added controls + initial logic to Insta bean view
Diffstat (limited to 'iBean/iBean')
-rw-r--r-- | iBean/iBean/InstaBeanViewController.h | 5 | ||||
-rw-r--r-- | iBean/iBean/InstaBeanViewController.m | 32 | ||||
-rw-r--r-- | iBean/iBean/en.lproj/MainStoryboard_iPhone.storyboard | 71 |
3 files changed, 90 insertions, 18 deletions
diff --git a/iBean/iBean/InstaBeanViewController.h b/iBean/iBean/InstaBeanViewController.h index a6d7700..7dbb6de 100644 --- a/iBean/iBean/InstaBeanViewController.h +++ b/iBean/iBean/InstaBeanViewController.h @@ -9,5 +9,10 @@ #import <UIKit/UIKit.h> @interface InstaBeanViewController : UIViewController +@property (weak, nonatomic) IBOutlet UILabel *extractionTimerLabel; +@property (weak, nonatomic) IBOutlet UIButton *extractionButton; +@property (weak, nonatomic) IBOutlet UIStepper *extractionSetupStepper; +@property (weak, nonatomic) IBOutlet UILabel *extractionTimerSettingLabel; +@property (nonatomic) BOOL extractionInProgress; @end diff --git a/iBean/iBean/InstaBeanViewController.m b/iBean/iBean/InstaBeanViewController.m index 776a8b5..e528122 100644 --- a/iBean/iBean/InstaBeanViewController.m +++ b/iBean/iBean/InstaBeanViewController.m @@ -14,6 +14,7 @@ @implementation InstaBeanViewController +/* - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; @@ -22,6 +23,7 @@ } return self; } + */ - (void)viewDidLoad { @@ -36,4 +38,34 @@ // Dispose of any resources that can be recreated. } + +//Insta bean methods +- (IBAction)setTimerInterval:(id)sender { + NSString *timerSetting = [NSString stringWithFormat:@"%1.0f", [self.extractionSetupStepper value]]; + NSLog(@"%@", timerSetting); + [self.extractionTimerSettingLabel setText:timerSetting]; +} + +- (IBAction)startExtraction:(id)sender { + if (self.extractionInProgress == NO) + { + //Update button text to "Stop extraction" + self.extractionInProgress = YES; + [self.extractionButton setTitle:@"Stop extraction" forState:UIControlStateNormal]; + [self.extractionButton setTintColor:[UIColor redColor]]; + //TODO: Set red background image. + //TODO: Start timer. + } + else + { + [self.extractionButton setTitle:@"Start extraction" forState:UIControlStateNormal]; + self.extractionInProgress = NO; + [self.extractionButton setTintColor:[UIColor greenColor]]; + //TODO: Set green background image. + //TODO: Halt timer + } + +} + + @end diff --git a/iBean/iBean/en.lproj/MainStoryboard_iPhone.storyboard b/iBean/iBean/en.lproj/MainStoryboard_iPhone.storyboard index d249629..0e1a2c4 100644 --- a/iBean/iBean/en.lproj/MainStoryboard_iPhone.storyboard +++ b/iBean/iBean/en.lproj/MainStoryboard_iPhone.storyboard @@ -50,31 +50,58 @@ <rect key="frame" x="0.0" y="20" width="320" height="499"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> - <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" text="Second View" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="22"> - <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> - <fontDescription key="fontDescription" name="Helvetica" family="Helvetica" pointSize="36"/> + <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="center" text="0.00" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CiC-m9-5rR"> + <constraints> + <constraint firstAttribute="height" constant="102" id="gVA-cu-kfz"/> + </constraints> + <fontDescription key="fontDescription" type="system" pointSize="76"/> + <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> + <nil key="highlightedColor"/> + </label> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ghy-eB-Fc0"> + <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/> + <state key="normal" title="Start extraction"> + <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="startExtraction:" destination="3" eventType="touchUpInside" id="XmK-mp-8Vw"/> + </connections> + </button> + <stepper opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="25" minimumValue="1" maximumValue="60" translatesAutoresizingMaskIntoConstraints="NO" id="507-KX-F4S"> + <connections> + <action selector="setTimerInterval:" destination="3" eventType="valueChanged" id="Bnl-Rg-Rc5"/> + </connections> + </stepper> + <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Fpj-yQ-Jhw"> + <fontDescription key="fontDescription" type="system" pointSize="17"/> <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> <nil key="highlightedColor"/> </label> - <textView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" userInteractionEnabled="NO" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" delaysContentTouches="NO" canCancelContentTouches="NO" minimumZoomScale="0.0" maximumZoomScale="0.0" bouncesZoom="NO" editable="NO" text="Loaded by the second view controller — an instance of SecondViewController — specified in the app delegate." textAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="23"> - <constraints> - <constraint firstAttribute="height" constant="88" id="cQR-IW-sY8"/> - </constraints> - <fontDescription key="fontDescription" type="system" size="system"/> - <textInputTraits key="textInputTraits"/> - </textView> </subviews> - <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> + <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <constraints> - <constraint firstItem="22" firstAttribute="leading" secondItem="17" secondAttribute="leading" constant="20" symbolic="YES" type="default" id="0q6-IA-e8m"/> - <constraint firstAttribute="trailing" secondItem="23" secondAttribute="trailing" constant="20" symbolic="YES" type="default" id="fR4-wH-Ih7"/> - <constraint firstItem="23" firstAttribute="leading" secondItem="17" secondAttribute="leading" constant="20" symbolic="YES" type="default" id="fzb-YA-SeR"/> - <constraint firstAttribute="centerY" secondItem="23" secondAttribute="centerY" type="user" id="llH-eD-iPS"/> - <constraint firstAttribute="trailing" secondItem="22" secondAttribute="trailing" constant="20" symbolic="YES" type="default" id="pc3-9Y-W42"/> - <constraint firstItem="23" firstAttribute="top" secondItem="22" secondAttribute="bottom" constant="40" type="user" id="yUx-Ee-KEk"/> + <constraint firstItem="CiC-m9-5rR" firstAttribute="top" secondItem="17" secondAttribute="top" constant="20" symbolic="YES" type="default" id="06y-M2-rw2"/> + <constraint firstItem="Fpj-yQ-Jhw" firstAttribute="leading" secondItem="17" secondAttribute="leading" constant="44" id="19h-RC-Nah"/> + <constraint firstItem="507-KX-F4S" firstAttribute="top" secondItem="17" secondAttribute="top" constant="195" id="522-46-RaI"/> + <constraint firstAttribute="bottom" secondItem="ghy-eB-Fc0" secondAttribute="bottom" constant="89" id="SNh-xW-kDd"/> + <constraint firstAttribute="trailing" secondItem="507-KX-F4S" secondAttribute="trailing" constant="57" id="bIe-JJ-xvH"/> + <constraint firstItem="CiC-m9-5rR" firstAttribute="leading" secondItem="17" secondAttribute="leading" constant="20" symbolic="YES" type="default" id="f2w-yL-dYN"/> + <constraint firstAttribute="trailing" secondItem="CiC-m9-5rR" secondAttribute="trailing" constant="20" symbolic="YES" type="default" id="jt9-2B-vlF"/> + <constraint firstItem="ghy-eB-Fc0" firstAttribute="centerX" secondItem="CiC-m9-5rR" secondAttribute="centerX" type="default" id="qAx-gx-lyV"/> + <constraint firstItem="Fpj-yQ-Jhw" firstAttribute="centerY" secondItem="507-KX-F4S" secondAttribute="centerY" type="default" id="uct-q5-tbD"/> </constraints> </view> - <tabBarItem key="tabBarItem" title="Second" image="second" id="6"/> + <tabBarItem key="tabBarItem" title="Insta bean" image="second" id="6"/> + <connections> + <outlet property="extractionButton" destination="ghy-eB-Fc0" id="XCY-hn-3mK"/> + <outlet property="extractionSetupStepper" destination="507-KX-F4S" id="nnb-jU-llM"/> + <outlet property="extractionTimerLabel" destination="CiC-m9-5rR" id="8qh-Y6-1s1"/> + <outlet property="extractionTimerSettingLabel" destination="Fpj-yQ-Jhw" id="am4-jQ-vy1"/> + </connections> </viewController> <placeholder placeholderIdentifier="IBFirstResponder" id="12" sceneMemberID="firstResponder"/> </objects> @@ -110,6 +137,14 @@ </class> <class className="InstaBeanViewController" superclassName="UIViewController"> <source key="sourceIdentifier" type="project" relativePath="./Classes/InstaBeanViewController.h"/> + <relationships> + <relationship kind="action" name="setTimerInterval:"/> + <relationship kind="action" name="startExtraction:"/> + <relationship kind="outlet" name="extractionButton" candidateClass="UIButton"/> + <relationship kind="outlet" name="extractionSetupStepper" candidateClass="UIStepper"/> + <relationship kind="outlet" name="extractionTimerLabel" candidateClass="UILabel"/> + <relationship kind="outlet" name="extractionTimerSettingLabel" candidateClass="UILabel"/> + </relationships> </class> <class className="NSLayoutConstraint" superclassName="NSObject"> <source key="sourceIdentifier" type="project" relativePath="./Classes/NSLayoutConstraint.h"/> |