Permalink
Browse files

Add today tshirt view controller to iPhone stotoryboard

  • Loading branch information...
1 parent b8371d9 commit d53465f986a1e04da31f679a322c3ff7505636a1 @vtourraine vtourraine committed May 1, 2012
@@ -8,6 +8,7 @@
#import "MTEAppDelegate.h"
+#import "MTETodayTShirtViewController.h"
#import "MTETShirtsViewController.h"
#import "MTESettingsViewController.h"
@@ -45,12 +46,15 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
else
{
UITabBarController *tabBarController = (UITabBarController*)self.window.rootViewController;
- UINavigationController * navController1 = [tabBarController.viewControllers objectAtIndex:0];
+ UINavigationController * navController0 = [tabBarController.viewControllers objectAtIndex:0];
+ MTETodayTShirtViewController * todayViewController = (MTETodayTShirtViewController*)navController0.topViewController;
+ UINavigationController * navController1 = [tabBarController.viewControllers objectAtIndex:1];
MTETShirtsViewController * tshirtsViewController = (MTETShirtsViewController*)navController1.topViewController;
- UINavigationController * navController2 = [tabBarController.viewControllers objectAtIndex:1];
+ UINavigationController * navController2 = [tabBarController.viewControllers objectAtIndex:2];
MTESettingsViewController * settingsViewController = (MTESettingsViewController*)navController2.topViewController;
settingsViewController.syncManager = tshirtsViewController.syncManager;
+ todayViewController.managedObjectContext = self.managedObjectContext;
}
return YES;
@@ -0,0 +1,15 @@
+//
+// MTETodayTShirtViewController.h
+// mytee
+//
+// Created by Vincent Tourraine on 5/2/12.
+// Copyright (c) 2012 Keres-Sy, Studio AMANgA. All rights reserved.
+//
+
+#import "MTETShirtViewController.h"
+
+@interface MTETodayTShirtViewController : MTETShirtViewController
+
+@property (nonatomic, weak) NSManagedObjectContext * managedObjectContext;
+
+@end
@@ -0,0 +1,67 @@
+//
+// MTETodayTShirtViewController.m
+// mytee
+//
+// Created by Vincent Tourraine on 5/2/12.
+// Copyright (c) 2012 Keres-Sy, Studio AMANgA. All rights reserved.
+//
+
+#import "MTETodayTShirtViewController.h"
+
+#import "MTETShirt.h"
+
+@interface MTETodayTShirtViewController ()
+
+@property (weak, nonatomic) IBOutlet UILabel *emptyDataLabel;
+
+@end
+
+@implementation MTETodayTShirtViewController
+@synthesize emptyDataLabel;
+
+@synthesize managedObjectContext;
+
+- (void)viewWillAppear:(BOOL)animated
+{
+ [super viewWillAppear:animated];
+
+ NSDate * today = [NSDate date];
+ NSCalendar * gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
+ NSDateComponents * components = [[NSDateComponents alloc] init];
+ NSUInteger unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit;
+ components = [gregorian components:unitFlags fromDate:today];
+ components.hour = 0;
+ components.minute = 0;
+ NSDate * todayMidnight = [gregorian dateFromComponents:components];
+
+ NSFetchRequest * fetchRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass([MTETShirt class])];
+ NSPredicate * predicate = [NSPredicate predicateWithFormat:@"ANY wears.date > %@", todayMidnight];
+ [fetchRequest setPredicate:predicate];
+
+ NSError * error = nil;
+ NSArray * todayTShirts = [self.managedObjectContext executeFetchRequest:fetchRequest error:&error];
+ if (!error && todayTShirts && [todayTShirts count]>0)
+ {
+ self.tshirt = [todayTShirts lastObject];
+ }
+ else
+ {
+ self.tshirt = nil;
+ }
+}
+
+- (void)viewDidUnload
+{
+ [super viewDidUnload];
+
+ self.emptyDataLabel = nil;
+}
+
+- (void)configureView
+{
+ [super configureView];
+
+ self.emptyDataLabel.hidden = (self.tshirt != nil);
+}
+
+@end
@@ -410,7 +410,7 @@
<navigationItem key="navigationItem" title="Wash History" id="rAl-9w-Oku"/>
</tableViewController>
</objects>
- <point key="canvasLocation" x="2315" y="-787"/>
+ <point key="canvasLocation" x="2841" y="-787"/>
</scene>
<!--Wear Wash View Controller - Wear History-->
<scene sceneID="Zl6-37-ePq">
@@ -454,7 +454,7 @@
<navigationItem key="navigationItem" title="Wear History" id="EoT-DQ-5Dy"/>
</tableViewController>
</objects>
- <point key="canvasLocation" x="1875" y="-787"/>
+ <point key="canvasLocation" x="2401" y="-787"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="auR-ws-a1u">
@@ -662,12 +662,148 @@
<autoresizingMask key="autoresizingMask"/>
</tabBar>
<connections>
+ <segue destination="Onm-WV-IXO" kind="relationship" relationship="viewControllers" id="Bqq-kb-Cyd"/>
<segue destination="2mb-jW-cge" kind="relationship" relationship="viewControllers" id="634-bL-UpM"/>
<segue destination="9ba-Tg-mkM" kind="relationship" relationship="viewControllers" id="y8G-7T-b9Y"/>
</connections>
</tabBarController>
</objects>
- <point key="canvasLocation" x="-46" y="658"/>
+ <point key="canvasLocation" x="12" y="442"/>
+ </scene>
+ <!--TodayT Shirt View Controller - Today-->
+ <scene sceneID="yPI-fw-Cfy">
+ <objects>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="r0M-Up-FbA" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ <viewController id="DJY-4b-xaN" customClass="MTETodayTShirtViewController" sceneMemberID="viewController">
+ <view key="view" contentMode="scaleToFill" id="GSA-Sa-wvV" customClass="UIScrollView">
+ <rect key="frame" x="0.0" y="64" width="320" height="600"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <subviews>
+ <imageView userInteractionEnabled="NO" contentMode="scaleToFill" id="dQ7-bi-PuK">
+ <rect key="frame" x="20" y="20" width="280" height="280"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ </imageView>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="7k9-oS-Xno">
+ <rect key="frame" x="20" y="392" width="135" height="37"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
+ <state key="normal" title="Wear History">
+ <color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
+ <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ <state key="highlighted">
+ <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ </button>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="FLo-5Z-KHu">
+ <rect key="frame" x="165" y="392" width="135" height="37"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
+ <state key="normal" title="Wash History">
+ <color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
+ <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ <state key="highlighted">
+ <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ </button>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="jL8-AL-w0z">
+ <rect key="frame" x="20" y="346" width="280" height="38"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
+ <inset key="contentEdgeInsets" minX="8" minY="0.0" maxX="0.0" maxY="0.0"/>
+ <inset key="titleEdgeInsets" minX="5" minY="0.0" maxX="0.0" maxY="0.0"/>
+ <state key="normal" title="Store" image="80-shopping-cart.png">
+ <color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
+ <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ <state key="highlighted">
+ <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ </button>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="★★★★☆" lineBreakMode="tailTruncation" minimumFontSize="10" id="ivi-Z7-dqQ">
+ <rect key="frame" x="20" y="308" width="116" height="38"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="XS" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" id="mhw-4K-Xzn">
+ <rect key="frame" x="258" y="316" width="42" height="22"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
+ <color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
+ <nil key="highlightedColor"/>
+ <color key="shadowColor" cocoaTouchSystemColor="darkTextColor"/>
+ <size key="shadowOffset" width="0.0" height="1"/>
+ </label>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Labels" lineBreakMode="tailTruncation" minimumFontSize="10" id="f0a-bN-myd">
+ <rect key="frame" x="58" y="437" width="242" height="27"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="system" pointSize="15"/>
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <imageView userInteractionEnabled="NO" contentMode="center" image="14-tag.png" id="2ZG-nW-bNX">
+ <rect key="frame" x="26" y="437" width="30" height="27"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ </imageView>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Notes" lineBreakMode="tailTruncation" numberOfLines="0" minimumFontSize="10" id="5Gl-v1-aNH">
+ <rect key="frame" x="58" y="478" width="242" height="18"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="system" pointSize="15"/>
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <imageView userInteractionEnabled="NO" contentMode="center" image="179-notepad.png" id="3Og-a7-gaY">
+ <rect key="frame" x="26" y="470" width="30" height="34"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ </imageView>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Time to Dress Up!" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="b4X-Aj-eDk">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="320"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <nil key="highlightedColor"/>
+ </label>
+ </subviews>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ </view>
+ <navigationItem key="navigationItem" title="Today" id="HNw-MT-Atx"/>
+ <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
+ <connections>
+ <outlet property="emptyDataLabel" destination="b4X-Aj-eDk" id="Xf5-IL-FCP"/>
+ <outlet property="noteIconImageView" destination="3Og-a7-gaY" id="qZF-wf-oY8"/>
+ <outlet property="noteLabel" destination="5Gl-v1-aNH" id="D7f-rZ-tgU"/>
+ <outlet property="ratingLabel" destination="ivi-Z7-dqQ" id="DBD-IZ-ZPh"/>
+ <outlet property="sizeLabel" destination="mhw-4K-Xzn" id="hIL-qg-JJJ"/>
+ <outlet property="storeButton" destination="jL8-AL-w0z" id="pHH-rF-cGE"/>
+ <outlet property="tagsLabel" destination="f0a-bN-myd" id="80A-Qu-Kmj"/>
+ <outlet property="tshirtImageView" destination="dQ7-bi-PuK" id="wV2-XL-WcH"/>
+ </connections>
+ </viewController>
+ </objects>
+ <point key="canvasLocation" x="1274" y="-886"/>
+ </scene>
+ <!--Navigation Controller - Today-->
+ <scene sceneID="RI9-D4-F2s">
+ <objects>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="cht-ZF-ed8" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ <navigationController id="Onm-WV-IXO" sceneMemberID="viewController">
+ <tabBarItem key="tabBarItem" title="Today" image="83-calendar.png" id="c4D-dT-cmZ"/>
+ <toolbarItems/>
+ <navigationBar key="navigationBar" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="IAc-sE-hUM">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
+ <autoresizingMask key="autoresizingMask"/>
+ </navigationBar>
+ <nil name="viewControllers"/>
+ <connections>
+ <segue destination="DJY-4b-xaN" kind="relationship" relationship="rootViewController" id="zux-xf-3c0"/>
+ </connections>
+ </navigationController>
+ </objects>
+ <point key="canvasLocation" x="769" y="-817"/>
</scene>
</scenes>
<resources>
@@ -741,6 +877,12 @@
<relationship kind="outlet" name="settingsBarButtonItem" candidateClass="UIBarButtonItem"/>
</relationships>
</class>
+ <class className="MTETodayTShirtViewController" superclassName="MTETShirtViewController">
+ <source key="sourceIdentifier" type="project" relativePath="./Classes/MTETodayTShirtViewController.h"/>
+ <relationships>
+ <relationship kind="outlet" name="emptyDataLabel" candidateClass="UILabel"/>
+ </relationships>
+ </class>
<class className="MTEWearWashViewController" superclassName="UITableViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/MTEWearWashViewController.h"/>
</class>
Oops, something went wrong.

0 comments on commit d53465f

Please sign in to comment.