Skip to content

Commit

Permalink
Close #26
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbranch committed Nov 20, 2013
1 parent d55b668 commit 011f4e4
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion SwitchaBLE/Base.lproj/Main_iPhone.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Device Name" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="12" adjustsLetterSpacingToFitWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cUU-i7-swD">
<rect key="frame" x="27" y="59" width="207" height="21"/>
<rect key="frame" x="20" y="59" width="207" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="HelveticaNeue-Thin" family="Helvetica Neue" pointSize="17"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
Expand Down Expand Up @@ -94,6 +94,7 @@
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="colonLabel" destination="146-Qf-yeZ" id="9cN-5o-bQL"/>
<outlet property="deviceLabel" destination="cUU-i7-swD" id="ZJQ-DZ-PBX"/>
<outlet property="hoursLabel" destination="fKa-hf-jzs" id="1HE-mR-xvD"/>
<outlet property="isSetSwitch" destination="jLp-JN-mwK" id="CrY-0v-Ckb"/>
Expand Down
Binary file removed SwitchaBLE/Images/70x70placeholder.png
Binary file not shown.
Binary file removed SwitchaBLE/Images/70x70placeholder.xcf
Binary file not shown.
1 change: 1 addition & 0 deletions SwitchaBLE/KSSAlarmTableViewCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
@interface KSSAlarmTableViewCell : UITableViewCell

@property (nonatomic, retain) IBOutlet UILabel *hoursLabel;
@property (nonatomic, retain) IBOutlet UILabel *colonLabel;
@property (nonatomic, retain) IBOutlet UILabel *minutesLabel;
@property (nonatomic, retain) IBOutlet UILabel *meridiemLabel;
@property (nonatomic, retain) IBOutlet UILabel *deviceLabel;
Expand Down
15 changes: 15 additions & 0 deletions SwitchaBLE/KSSAlarmsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ - (void)toggleAlarmSet:(UISwitch *)sender {
CGPoint switchPosition = [sender convertPoint:CGPointZero toView:self.tableView];
Alarm *alarm = [alarmsArray objectAtIndex:[self.tableView indexPathForRowAtPoint:switchPosition].row];
alarm.isSet = [NSNumber numberWithBool:sender.isOn];
[self formatCell:(KSSAlarmTableViewCell *)[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:[alarmsArray indexOfObject:alarm] inSection:0]] withAlarm:alarm];

//[appDelegate scheduleAlarm:alarm];
[appDelegate saveContext];
Expand All @@ -131,6 +132,20 @@ - (void)formatCell:(KSSAlarmTableViewCell *)cell withAlarm:(Alarm *)alarm {
dateFormatter.dateFormat = @"a";
cell.meridiemLabel.text = [dateFormatter stringFromDate:alarm.time];
cell.deviceLabel.text = alarm.device.name ?: @"No deivce selected";

if ([alarm.isSet boolValue]) {
cell.meridiemLabel.enabled =
cell.colonLabel.enabled =
cell.minutesLabel.enabled =
cell.hoursLabel.enabled =
cell.deviceLabel.enabled = YES;
} else {
cell.meridiemLabel.enabled =
cell.colonLabel.enabled =
cell.minutesLabel.enabled =
cell.hoursLabel.enabled =
cell.deviceLabel.enabled = NO;
}
}

#pragma mark - Table view data source
Expand Down

0 comments on commit 011f4e4

Please sign in to comment.