Permalink
Browse files

Cleanup master view and add color codes

  • Loading branch information...
josecastillo committed Aug 8, 2015
1 parent d0a18f1 commit a71994c978986d7dc38dea26adaded9014660791
@@ -16,6 +16,7 @@
E7E544D91B7667EE006E3021 /* TFMasterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E7E544D41B7667EE006E3021 /* TFMasterViewController.m */; };
E7E544DC1B766A77006E3021 /* TFLiveDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = E7E544DB1B766A77006E3021 /* TFLiveDataSource.m */; };
E7E544E11B768BA6006E3021 /* UIImage+TFSubwayLine.m in Sources */ = {isa = PBXBuildFile; fileRef = E7E544E01B768BA6006E3021 /* UIImage+TFSubwayLine.m */; };
E7E544E71B769B8A006E3021 /* UIColor+TFAlertColors.m in Sources */ = {isa = PBXBuildFile; fileRef = E7E544E61B769B8A006E3021 /* UIColor+TFAlertColors.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -36,6 +37,8 @@
E7E544DE1B76810C006E3021 /* Constants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Constants.h; sourceTree = "<group>"; };
E7E544DF1B768BA6006E3021 /* UIImage+TFSubwayLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+TFSubwayLine.h"; sourceTree = "<group>"; };
E7E544E01B768BA6006E3021 /* UIImage+TFSubwayLine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+TFSubwayLine.m"; sourceTree = "<group>"; };
E7E544E51B769B8A006E3021 /* UIColor+TFAlertColors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+TFAlertColors.h"; sourceTree = "<group>"; };
E7E544E61B769B8A006E3021 /* UIColor+TFAlertColors.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+TFAlertColors.m"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -132,6 +135,8 @@
children = (
E7E544DF1B768BA6006E3021 /* UIImage+TFSubwayLine.h */,
E7E544E01B768BA6006E3021 /* UIImage+TFSubwayLine.m */,
E7E544E51B769B8A006E3021 /* UIColor+TFAlertColors.h */,
E7E544E61B769B8A006E3021 /* UIColor+TFAlertColors.m */,
);
path = View;
sourceTree = "<group>";
@@ -206,6 +211,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E7E544E71B769B8A006E3021 /* UIColor+TFAlertColors.m in Sources */,
E7E544D91B7667EE006E3021 /* TFMasterViewController.m in Sources */,
E7E544D81B7667EE006E3021 /* TFDetailViewController.m in Sources */,
E7E544D71B7667EE006E3021 /* TFAppDelegate.m in Sources */,
@@ -106,24 +106,17 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" showsReorderControl="YES" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" shouldIndentWhileEditing="NO" reuseIdentifier="Cell" textLabel="Arm-wq-HPj" detailTextLabel="gcg-Uc-3yO" style="IBUITableViewCellStyleSubtitle" id="WCw-Qf-5nD">
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" showsReorderControl="YES" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" shouldIndentWhileEditing="NO" reuseIdentifier="Cell" textLabel="Arm-wq-HPj" style="IBUITableViewCellStyleDefault" id="WCw-Qf-5nD">
<rect key="frame" x="0.0" y="86" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="WCw-Qf-5nD" id="37f-cq-3Eg">
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Arm-wq-HPj">
<rect key="frame" x="15" y="5" width="32" height="20"/>
<rect key="frame" x="15" y="0.0" width="570" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Subtitle" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="gcg-Uc-3yO">
<rect key="frame" x="15" y="25" width="41" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
@@ -10,6 +10,7 @@
#import "TFDetailViewController.h"
#import "TFLiveDataSource.h"
#import "UIImage+TFSubwayLine.h"
#import "UIColor+TFAlertColors.h"
#import "Constants.h"
@@ -99,9 +100,11 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
NSString *line = self.lines[indexPath.row];
NSDictionary *lineStatus = self.systemStatus[kLiveDataSourceKeyLines][line];
cell.textLabel.text = line;
cell.detailTextLabel.text = lineStatus[kLiveDataSourceKeyStatus];
cell.textLabel.text = lineStatus[kLiveDataSourceKeyStatus];
cell.textLabel.textColor = [UIColor colorForAlertLevel:[lineStatus[@"alert"] integerValue]];
cell.imageView.image = [UIImage imageForSubwayLine:line withSize:44];
cell.imageView.accessibilityLabel = [line stringByAppendingString:@" Train"];
return cell;
}
@@ -0,0 +1,15 @@
//
// UIColor+TFAlertColors.h
// TrainFace
//
// Created by Joey Castillo on 8/8/15.
// Copyright © 2015 Panchromatic, LLC. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIColor (TFAlertColors)
+ (UIColor *)colorForAlertLevel:(NSInteger)alert;
@end
@@ -0,0 +1,33 @@
//
// UIColor+TFAlertColors.m
// TrainFace
//
// Created by Joey Castillo on 8/8/15.
// Copyright © 2015 Panchromatic, LLC. All rights reserved.
//
#import "UIColor+TFAlertColors.h"
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
@implementation UIColor (TFAlertColors)
// Based on the Homeland Security Advisory System colors
// Omitted: blue "Guarded" level (0x147BCE) and yellow "Elevated" level (0xF9DD00)
+ (UIColor *)colorForAlertLevel:(NSInteger)alert {
switch (alert) {
case 1:
case 2:
return UIColorFromRGB(0x00AC6B);
case 3:
return UIColorFromRGB(0xFF9600);
case 4:
case 5:
return UIColorFromRGB(0xFF0020);
default:
return [UIColor blackColor];
}
}
@end

0 comments on commit a71994c

Please sign in to comment.