Repository: square/objc-TimesSquare Branch: master Commit: 5138407efd3b Files: 35 Total size: 108.6 KB Directory structure: gitextract__e813hyf/ ├── .gitignore ├── .travis.yml ├── Gemfile ├── LICENSE ├── README.md ├── TimesSquare/ │ ├── TSQCalendarCell.h │ ├── TSQCalendarCell.m │ ├── TSQCalendarMonthHeaderCell.h │ ├── TSQCalendarMonthHeaderCell.m │ ├── TSQCalendarRowCell.h │ ├── TSQCalendarRowCell.m │ ├── TSQCalendarView.h │ ├── TSQCalendarView.m │ ├── TimesSquare-Prefix.pch │ └── TimesSquare.h ├── TimesSquare.podspec ├── TimesSquare.xcodeproj/ │ ├── project.pbxproj │ └── xcshareddata/ │ └── xcschemes/ │ ├── TimesSquare Documentation.xcscheme │ └── TimesSquare.xcscheme └── TimesSquareTestApp/ ├── TSQTAAppDelegate.h ├── TSQTAAppDelegate.m ├── TSQTACalendarRowCell.h ├── TSQTACalendarRowCell.m ├── TSQTAViewController.h ├── TSQTAViewController.m ├── TimesSquareTestApp-Info.plist ├── TimesSquareTestApp-Prefix.pch ├── TimesSquareTestApp.xcodeproj/ │ ├── project.pbxproj │ └── xcshareddata/ │ └── xcschemes/ │ └── TimesSquareTestApp.xcscheme ├── TimesSquareTestAppTests/ │ ├── TimesSquareTestAppTests-Info.plist │ ├── TimesSquareTestAppTests.h │ ├── TimesSquareTestAppTests.m │ └── en.lproj/ │ └── InfoPlist.strings ├── en.lproj/ │ └── InfoPlist.strings └── main.m ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ #Ignore the Mac OS X .DS_Store files .DS_Store #Ignore user-specific settings *.mode1v3 *.mode2v3 *.pbxuser *.perspectivev3 *.xcworkspace xcuserdata #Ignore textmate build errors *.tm_build_errors #Ignore temp nibs and swap files *.swp *~.nib #Ignore the build, since we don't want archived builds build .gitattributes #Probably don't want to check in xcuserdata xcuserdata/ *.xcworkspace/ *.orig .idea ================================================ FILE: .travis.yml ================================================ language: objective-c osx_image: xcode6.4 before_script: - bundle install script: - xcodebuild -project TimesSquare.xcodeproj -scheme TimesSquare -sdk iphonesimulator -configuration Debug -PBXBuildsContinueAfterErrors=0 ACTIVE_ARCH_ONLY=0 build - pod lib lint --verbose --fail-fast ================================================ FILE: Gemfile ================================================ source 'https://rubygems.org' gem 'cocoapods', '0.37.2' ================================================ FILE: LICENSE ================================================ TimesSquare Copyright 2012 Square, Inc. A full list of contributors is available at https://github.com/square/objc-TimesSquare/contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================ FILE: README.md ================================================ # TimesSquare [![CI Status](https://travis-ci.org/square/objc-TimesSquare.svg?branch=master)](https://travis-ci.org/square/objc-TimesSquare) [![Version](https://img.shields.io/cocoapods/v/TimesSquare.svg)](http://cocoadocs.org/docsets/TimesSquare) [![License](https://img.shields.io/cocoapods/l/TimesSquare.svg)](http://cocoadocs.org/docsets/TimesSquare) [![Platform](https://img.shields.io/cocoapods/p/TimesSquare.svg)](http://cocoadocs.org/docsets/TimesSquare) TimesSquare is a library to display a calendar in a view in your iPhone or iPad app. We wrote it after searching high and low for a better way and finding none. ## Usage ![Gregorian Calendar](https://github.com/square/objc-TimesSquare/raw/master/Documentation/gregorian.png) Easy: create an instance of `TSQCalendarView`. Set its `firstDate` and `lastDate` properties to give yourself a range of dates. ## Calendars ![Hebrew Calendar](https://github.com/square/objc-TimesSquare/raw/master/Documentation/hebrew.png) While we fully expect you'll use it to display a Gregorian calendar most of the time, TimesSquare is just as happy displaying any of the calendars `NSCalendar` supports. The included test app shows you how to do this. ## Further documentation If you install [appledoc](http://gentlebytes.com/appledoc/) ("`brew info homebrew/versions/appledoc22`", "`ln -s /usr/local/Cellar/appledoc22/2.2.1/bin/appledoc /usr/local/bin/appledoc`") you can build the "TimesSquare Documentation" target in Xcode and see (and search!) the full API in your documentation window. ## Contributing We're glad you're interested in TimesSquare, and we'd love to see where you take it. Any contributors to the master TimesSquare repository must sign the [Individual Contributor License Agreement (CLA)](https://spreadsheets.google.com/spreadsheet/viewform?formkey=dDViT2xzUHAwRkI3X3k5Z0lQM091OGc6MQ&ndplr=1). It's a short form that covers our bases and makes sure you're eligible to contribute. When you have a change you'd like to see in the master repository, [send a pull request](https://github.com/square/objc-TimesSquare/pulls). Before we merge your request, we'll make sure you're in the list of people who have signed a CLA. Thanks, and happy date picking! ================================================ FILE: TimesSquare/TSQCalendarCell.h ================================================ // // TSQCalendarCell.h // TimesSquare // // Created by Jim Puls on 11/15/12. // Licensed to Square, Inc. under one or more contributor license agreements. // See the LICENSE file distributed with this work for the terms under // which Square, Inc. licenses this file to you. #import @class TSQCalendarView; /** The `TSQCalendarCell` class is an abstract superclass to the two cell types used for display in a `TSQCalendarView`. Most of its interface deals with display properties. The most interesting method is `-layoutViewsForColumnAtIndex:inRect:`, which is a simple way of handling seven columns. */ @interface TSQCalendarCell : UITableViewCell /** @name State Properties Set by Calendar View */ /** The first day of the month this cell is currently representing. This can be useful for calculations and for display. */ @property (nonatomic, strong) NSDate *firstOfMonth; /** How many days there are in a week. This is usually 7. */ @property (nonatomic, readonly) NSUInteger daysInWeek; /** The calendar type we're displaying. This is whatever the owning `TSQCalendarView`'s `calendar` property is set to; it's likely `[NSCalendar currentCalendar]`. */ @property (nonatomic, strong) NSCalendar *calendar; /** The owning calendar view. This is a weak reference. */ @property (nonatomic, weak) TSQCalendarView *calendarView; /** @name Display Properties */ /** The preferred height for instances of this cell. The built-in implementation in `TSQCalendarCell` returns `46.0f`. Your subclass may want to return another value. */ + (CGFloat) cellHeight; /** The text color. This is used for all text the cell draws; if a date is disabled, then it will draw in this color, but at 50% opacity. */ @property (nonatomic, strong) UIColor *textColor; /** The text shadow offset. This is as you would set on `UILabel`. */ @property (nonatomic) CGSize shadowOffset; /** The spacing between columns. This defaults to one pixel or `1.0 / [UIScreen mainScreen].scale`. */ @property (nonatomic) CGFloat columnSpacing; /** @name Initialization */ /** Initializes the cell. @param calendar The `NSCalendar` the cell is representing @param reuseIdentifier A string reuse identifier, as used by `UITableViewCell` */ - (id)initWithCalendar:(NSCalendar *)calendar reuseIdentifier:(NSString *)reuseIdentifier; /** Seven-column layout helper. @param index The index of the column we're laying out, probably in the range [0..6] @param rect The rect relative to the bounds of the cell's content view that represents the column. Feel free to adjust the rect before moving views and to vertically position them within the column. (In fact, you could ignore the rect entirely; it's just there to help.) */ - (void)layoutViewsForColumnAtIndex:(NSUInteger)index inRect:(CGRect)rect; @end ================================================ FILE: TimesSquare/TSQCalendarCell.m ================================================ // // TSQCalendarCell.m // TimesSquare // // Created by Jim Puls on 11/15/12. // Licensed to Square, Inc. under one or more contributor license agreements. // See the LICENSE file distributed with this work for the terms under // which Square, Inc. licenses this file to you. #import "TSQCalendarCell.h" #import "TSQCalendarView.h" @interface TSQCalendarCell () @property (nonatomic, assign) NSLocaleLanguageDirection layoutDirection; @end @implementation TSQCalendarCell - (id)initWithCalendar:(NSCalendar *)calendar reuseIdentifier:(NSString *)reuseIdentifier; { self = [self initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier]; if (!self) { return nil; } _calendar = calendar; NSString *languageCode = [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode]; self.layoutDirection = [NSLocale characterDirectionForLanguage:languageCode]; self.backgroundColor = [UIColor colorWithRed:0.84f green:0.85f blue:0.86f alpha:1.0f]; CGFloat onePixel = 1.0f / [UIScreen mainScreen].scale; static CGSize shadowOffset; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ shadowOffset = CGSizeMake(0.0f, onePixel); }); self.shadowOffset = shadowOffset; self.columnSpacing = onePixel; self.textColor = [UIColor colorWithRed:0.47f green:0.5f blue:0.53f alpha:1.0f]; return self; } + (CGFloat)cellHeight; { return 46.0f; } - (NSUInteger)daysInWeek; { static NSUInteger daysInWeek = 0; if (daysInWeek == 0) { daysInWeek = [self.calendar maximumRangeOfUnit:NSWeekdayCalendarUnit].length; } return daysInWeek; } - (UITableViewCellSelectionStyle)selectionStyle; { return UITableViewCellSelectionStyleNone; } - (void)setHighlighted:(BOOL)selected animated:(BOOL)animated; { // do nothing } - (void)setSelected:(BOOL)selected animated:(BOOL)animated; { // do nothing } - (void)layoutViewsForColumnAtIndex:(NSUInteger)index inRect:(CGRect)rect; { // for subclass to implement } - (void)layoutSubviews; { [super layoutSubviews]; UIEdgeInsets insets = self.calendarView.contentInset; CGRect insetRect = UIEdgeInsetsInsetRect(self.bounds, insets); insetRect.origin.y = CGRectGetMinY(self.bounds); insetRect.size.height = CGRectGetHeight(self.bounds); CGFloat increment = (CGRectGetWidth(insetRect) - (self.daysInWeek - 1) * self.columnSpacing) / self.daysInWeek; increment = roundf(increment); CGFloat __block start = insets.left; CGFloat extraSpace = (CGRectGetWidth(insetRect) - (self.daysInWeek - 1) * self.columnSpacing) - (increment * self.daysInWeek); // Divide the extra space out over the outer columns in increments of the column spacing NSInteger columnsWithExtraSpace = (NSInteger)fabs(extraSpace / self.columnSpacing); NSInteger columnsOnLeftWithExtraSpace = columnsWithExtraSpace / 2; NSInteger columnsOnRightWithExtraSpace = columnsWithExtraSpace - columnsOnLeftWithExtraSpace; for (NSUInteger index = 0; index < self.daysInWeek; index++) { CGFloat width = increment; if (index < columnsOnLeftWithExtraSpace || index >= self.daysInWeek - columnsOnRightWithExtraSpace) { width += (extraSpace / columnsWithExtraSpace); } NSUInteger displayIndex = index; if (self.layoutDirection == NSLocaleLanguageDirectionRightToLeft) { displayIndex = self.daysInWeek - index - 1; } CGRect columnBounds = self.bounds; columnBounds.origin.x = start; columnBounds.size.width = width; [self layoutViewsForColumnAtIndex:displayIndex inRect:columnBounds]; start += width + self.columnSpacing; } } @end ================================================ FILE: TimesSquare/TSQCalendarMonthHeaderCell.h ================================================ // // TSQCalendarMonthHeaderCell.h // TimesSquare // // Created by Jim Puls on 11/14/12. // Licensed to Square, Inc. under one or more contributor license agreements. // See the LICENSE file distributed with this work for the terms under // which Square, Inc. licenses this file to you. #import "TSQCalendarCell.h" /** The `TSQCalendarMonthHeaderCell` class displays the month name and day names at the top of a month's worth of weeks. By default, it lays out the day names in the bottom 20 points, the month name in the remainder of its height, and has a height of 65 points. You'll want to subclass it to change any of those things. */ @interface TSQCalendarMonthHeaderCell : TSQCalendarCell /** @name Day Labels */ /** The day header labels. The count is equal to the `daysInWeek` property, likely seven. You can position them in the call to `layoutViewsForColumnAtIndex:inRect:`. */ @property (nonatomic, strong) NSArray *headerLabels; /** Creates the header labels. If you want the text in your header labels to be something other than the short day format ("Mon Tue Wed" etc.), override this method, call `super`, and loop through `self.headerLabels`, changing their text. */ - (void)createHeaderLabels; @end ================================================ FILE: TimesSquare/TSQCalendarMonthHeaderCell.m ================================================ // // TSQCalendarMonthHeaderCell.m // TimesSquare // // Created by Jim Puls on 11/14/12. // Licensed to Square, Inc. under one or more contributor license agreements. // See the LICENSE file distributed with this work for the terms under // which Square, Inc. licenses this file to you. #import "TSQCalendarMonthHeaderCell.h" static const CGFloat TSQCalendarMonthHeaderCellMonthsHeight = 20.f; @interface TSQCalendarMonthHeaderCell () @property (nonatomic, strong) NSDateFormatter *monthDateFormatter; @end @implementation TSQCalendarMonthHeaderCell - (id)initWithCalendar:(NSCalendar *)calendar reuseIdentifier:(NSString *)reuseIdentifier; { self = [super initWithCalendar:calendar reuseIdentifier:reuseIdentifier]; if (!self) { return nil; } [self createHeaderLabels]; return self; } + (CGFloat)cellHeight; { return 65.0f; } - (NSDateFormatter *)monthDateFormatter; { if (!_monthDateFormatter) { _monthDateFormatter = [NSDateFormatter new]; _monthDateFormatter.calendar = self.calendar; NSString *dateComponents = @"yyyyLLLL"; _monthDateFormatter.dateFormat = [NSDateFormatter dateFormatFromTemplate:dateComponents options:0 locale:[NSLocale currentLocale]]; } return _monthDateFormatter; } - (void)createHeaderLabels; { NSDate *referenceDate = [NSDate dateWithTimeIntervalSinceReferenceDate:0]; NSDateComponents *offset = [NSDateComponents new]; offset.day = 1; NSMutableArray *headerLabels = [NSMutableArray arrayWithCapacity:self.daysInWeek]; NSDateFormatter *dayFormatter = [NSDateFormatter new]; dayFormatter.calendar = self.calendar; dayFormatter.dateFormat = @"cccccc"; for (NSUInteger index = 0; index < self.daysInWeek; index++) { [headerLabels addObject:@""]; } for (NSUInteger index = 0; index < self.daysInWeek; index++) { NSInteger ordinality = [self.calendar ordinalityOfUnit:NSDayCalendarUnit inUnit:NSWeekCalendarUnit forDate:referenceDate]; UILabel *label = [[UILabel alloc] initWithFrame:self.frame]; label.textAlignment = UITextAlignmentCenter; label.text = [dayFormatter stringFromDate:referenceDate]; label.font = [UIFont boldSystemFontOfSize:12.f]; label.backgroundColor = self.backgroundColor; label.textColor = self.textColor; label.shadowColor = [UIColor whiteColor]; label.shadowOffset = self.shadowOffset; [label sizeToFit]; headerLabels[ordinality - 1] = label; [self.contentView addSubview:label]; referenceDate = [self.calendar dateByAddingComponents:offset toDate:referenceDate options:0]; } self.headerLabels = headerLabels; self.textLabel.textAlignment = UITextAlignmentCenter; self.textLabel.textColor = self.textColor; self.textLabel.shadowColor = [UIColor whiteColor]; self.textLabel.shadowOffset = self.shadowOffset; } - (void)layoutSubviews; { [super layoutSubviews]; CGRect bounds = self.contentView.bounds; bounds.size.height -= TSQCalendarMonthHeaderCellMonthsHeight; self.textLabel.frame = CGRectOffset(bounds, 0.0f, 5.0f); } - (void)layoutViewsForColumnAtIndex:(NSUInteger)index inRect:(CGRect)rect; { UILabel *label = self.headerLabels[index]; CGRect labelFrame = rect; labelFrame.size.height = TSQCalendarMonthHeaderCellMonthsHeight; labelFrame.origin.y = self.bounds.size.height - TSQCalendarMonthHeaderCellMonthsHeight; label.frame = labelFrame; } - (void)setFirstOfMonth:(NSDate *)firstOfMonth; { [super setFirstOfMonth:firstOfMonth]; self.textLabel.text = [self.monthDateFormatter stringFromDate:firstOfMonth]; self.accessibilityLabel = self.textLabel.text; } - (void)setBackgroundColor:(UIColor *)backgroundColor; { [super setBackgroundColor:backgroundColor]; for (UILabel *label in self.headerLabels) { label.backgroundColor = backgroundColor; } } @end ================================================ FILE: TimesSquare/TSQCalendarRowCell.h ================================================ // // TSQCalendarRowCell.h // TimesSquare // // Created by Jim Puls on 11/14/12. // Licensed to Square, Inc. under one or more contributor license agreements. // See the LICENSE file distributed with this work for the terms under // which Square, Inc. licenses this file to you. #import "TSQCalendarCell.h" /** The `TSQCalendarRowCell` class is a cell that represents one week in the calendar. Each of the seven columns can represent a day that's in this month, a day that's not in this month, a selected day, today, or an unselected day. The cell uses several images placed strategically to achieve the effect. */ @interface TSQCalendarRowCell : TSQCalendarCell /** @name Images */ /** The background image for the entire row. This image should be as wide as the entire view and include the grid lines between the columns. It will probably also include the grid line at the top of the row, but not the one at the bottom. You might, however, return a different image that includes both the grid line at the top and the one at the bottom if the `bottomRow` property is set to `YES`. You might even adjust the `cellHeight`. */ @property (nonatomic, weak, readonly) UIImage *backgroundImage; /** The background image for a day that's selected. This is blue in the system's built-in Calendar app. You probably want to use a stretchable image. */ @property (nonatomic, weak, readonly) UIImage *selectedBackgroundImage; /** The background image for a day that's "today". This is dark gray in the system's built-in Calendar app. You probably want to use a stretchable image. */ @property (nonatomic, weak, readonly) UIImage *todayBackgroundImage; /** The background image for a day that's not this month. These are the trailing days from the previous month or the leading days from the following month. This can be `nil`. */ @property (nonatomic, weak, readonly) UIImage *notThisMonthBackgroundImage; /** @name State Properties Set by Calendar View */ /** The date at the beginning of the week for this cell. Notice that it might be before the `firstOfMonth` property or it might be after. */ @property (nonatomic, strong) NSDate *beginningDate; /** Whether this cell is the bottom row / last week for the month. You may find yourself using a different background image or laying out differently in the last row. */ @property (nonatomic, getter = isBottomRow) BOOL bottomRow; /** Method to select a specific date within the week. This is funneled through and called by the calendar view, to facilitate deselection of other rows. @param date The date to select, or nil to deselect all columns. */ - (void)selectColumnForDate:(NSDate *)date; @end ================================================ FILE: TimesSquare/TSQCalendarRowCell.m ================================================ // // TSQCalendarRowCell.m // TimesSquare // // Created by Jim Puls on 11/14/12. // Licensed to Square, Inc. under one or more contributor license agreements. // See the LICENSE file distributed with this work for the terms under // which Square, Inc. licenses this file to you. #import "TSQCalendarRowCell.h" #import "TSQCalendarView.h" @interface TSQCalendarRowCell () @property (nonatomic, strong) NSArray *dayButtons; @property (nonatomic, strong) NSArray *notThisMonthButtons; @property (nonatomic, strong) UIButton *todayButton; @property (nonatomic, strong) UIButton *selectedButton; @property (nonatomic, assign) NSInteger indexOfTodayButton; @property (nonatomic, assign) NSInteger indexOfSelectedButton; @property (nonatomic, strong) NSDateFormatter *dayFormatter; @property (nonatomic, strong) NSDateFormatter *accessibilityFormatter; @property (nonatomic, strong) NSDateComponents *todayDateComponents; @property (nonatomic) NSInteger monthOfBeginningDate; @end @implementation TSQCalendarRowCell - (id)initWithCalendar:(NSCalendar *)calendar reuseIdentifier:(NSString *)reuseIdentifier; { self = [super initWithCalendar:calendar reuseIdentifier:reuseIdentifier]; if (!self) { return nil; } return self; } - (void)configureButton:(UIButton *)button; { button.titleLabel.font = [UIFont boldSystemFontOfSize:19.f]; button.titleLabel.shadowOffset = self.shadowOffset; button.adjustsImageWhenDisabled = NO; [button setTitleColor:self.textColor forState:UIControlStateNormal]; [button setTitleShadowColor:[UIColor whiteColor] forState:UIControlStateNormal]; } - (void)createDayButtons; { NSMutableArray *dayButtons = [NSMutableArray arrayWithCapacity:self.daysInWeek]; for (NSUInteger index = 0; index < self.daysInWeek; index++) { UIButton *button = [[UIButton alloc] initWithFrame:self.contentView.bounds]; [button addTarget:self action:@selector(dateButtonPressed:) forControlEvents:UIControlEventTouchDown]; [dayButtons addObject:button]; [self.contentView addSubview:button]; [self configureButton:button]; [button setTitleColor:[self.textColor colorWithAlphaComponent:0.5f] forState:UIControlStateDisabled]; } self.dayButtons = dayButtons; } - (void)createNotThisMonthButtons; { NSMutableArray *notThisMonthButtons = [NSMutableArray arrayWithCapacity:self.daysInWeek]; for (NSUInteger index = 0; index < self.daysInWeek; index++) { UIButton *button = [[UIButton alloc] initWithFrame:self.contentView.bounds]; [notThisMonthButtons addObject:button]; [self.contentView addSubview:button]; [self configureButton:button]; button.enabled = NO; UIColor *backgroundPattern = [UIColor colorWithPatternImage:[self notThisMonthBackgroundImage]]; button.backgroundColor = backgroundPattern; button.titleLabel.backgroundColor = backgroundPattern; } self.notThisMonthButtons = notThisMonthButtons; } - (void)createTodayButton; { self.todayButton = [[UIButton alloc] initWithFrame:self.contentView.bounds]; [self.contentView addSubview:self.todayButton]; [self configureButton:self.todayButton]; [self.todayButton addTarget:self action:@selector(todayButtonPressed:) forControlEvents:UIControlEventTouchDown]; [self.todayButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [self.todayButton setBackgroundImage:[self todayBackgroundImage] forState:UIControlStateNormal]; [self.todayButton setTitleShadowColor:[UIColor colorWithWhite:0.0f alpha:0.75f] forState:UIControlStateNormal]; self.todayButton.titleLabel.shadowOffset = CGSizeMake(0.0f, -1.0f / [UIScreen mainScreen].scale); } - (void)createSelectedButton; { self.selectedButton = [[UIButton alloc] initWithFrame:self.contentView.bounds]; [self.contentView addSubview:self.selectedButton]; [self configureButton:self.selectedButton]; [self.selectedButton setAccessibilityTraits:UIAccessibilityTraitSelected|self.selectedButton.accessibilityTraits]; self.selectedButton.enabled = NO; [self.selectedButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [self.selectedButton setBackgroundImage:[self selectedBackgroundImage] forState:UIControlStateNormal]; [self.selectedButton setTitleShadowColor:[UIColor colorWithWhite:0.0f alpha:0.75f] forState:UIControlStateNormal]; self.selectedButton.titleLabel.shadowOffset = CGSizeMake(0.0f, -1.0f / [UIScreen mainScreen].scale); self.indexOfSelectedButton = -1; } - (void)setBeginningDate:(NSDate *)date; { _beginningDate = date; if (!self.dayButtons) { [self createDayButtons]; [self createNotThisMonthButtons]; [self createTodayButton]; [self createSelectedButton]; } NSDateComponents *offset = [NSDateComponents new]; offset.day = 1; self.todayButton.hidden = YES; self.indexOfTodayButton = -1; self.selectedButton.hidden = YES; self.indexOfSelectedButton = -1; for (NSUInteger index = 0; index < self.daysInWeek; index++) { NSString *title = [self.dayFormatter stringFromDate:date]; NSString *accessibilityLabel = [self.accessibilityFormatter stringFromDate:date]; [self.dayButtons[index] setTitle:title forState:UIControlStateNormal]; [self.dayButtons[index] setAccessibilityLabel:accessibilityLabel]; [self.notThisMonthButtons[index] setTitle:title forState:UIControlStateNormal]; [self.notThisMonthButtons[index] setTitle:title forState:UIControlStateDisabled]; [self.notThisMonthButtons[index] setAccessibilityLabel:accessibilityLabel]; NSDateComponents *thisDateComponents = [self.calendar components:NSDayCalendarUnit|NSMonthCalendarUnit|NSYearCalendarUnit fromDate:date]; [self.dayButtons[index] setHidden:YES]; [self.notThisMonthButtons[index] setHidden:YES]; NSInteger thisDayMonth = thisDateComponents.month; if (self.monthOfBeginningDate != thisDayMonth) { [self.notThisMonthButtons[index] setHidden:NO]; } else { if ([self.todayDateComponents isEqual:thisDateComponents]) { self.todayButton.hidden = NO; [self.todayButton setTitle:title forState:UIControlStateNormal]; [self.todayButton setAccessibilityLabel:accessibilityLabel]; self.indexOfTodayButton = index; } else { UIButton *button = self.dayButtons[index]; button.enabled = ![self.calendarView.delegate respondsToSelector:@selector(calendarView:shouldSelectDate:)] || [self.calendarView.delegate calendarView:self.calendarView shouldSelectDate:date]; button.hidden = NO; } } date = [self.calendar dateByAddingComponents:offset toDate:date options:0]; } } - (void)setBottomRow:(BOOL)bottomRow; { UIImageView *backgroundImageView = (UIImageView *)self.backgroundView; if ([backgroundImageView isKindOfClass:[UIImageView class]] && _bottomRow == bottomRow) { return; } _bottomRow = bottomRow; self.backgroundView = [[UIImageView alloc] initWithImage:self.backgroundImage]; [self setNeedsLayout]; } - (IBAction)dateButtonPressed:(id)sender; { NSDateComponents *offset = [NSDateComponents new]; offset.day = [self.dayButtons indexOfObject:sender]; NSDate *selectedDate = [self.calendar dateByAddingComponents:offset toDate:self.beginningDate options:0]; self.calendarView.selectedDate = selectedDate; } - (IBAction)todayButtonPressed:(id)sender; { NSDateComponents *offset = [NSDateComponents new]; offset.day = self.indexOfTodayButton; NSDate *selectedDate = [self.calendar dateByAddingComponents:offset toDate:self.beginningDate options:0]; self.calendarView.selectedDate = selectedDate; } - (void)layoutSubviews; { if (!self.backgroundView) { [self setBottomRow:NO]; } [super layoutSubviews]; self.backgroundView.frame = self.bounds; } - (void)layoutViewsForColumnAtIndex:(NSUInteger)index inRect:(CGRect)rect; { UIButton *dayButton = self.dayButtons[index]; UIButton *notThisMonthButton = self.notThisMonthButtons[index]; dayButton.frame = rect; notThisMonthButton.frame = rect; if (self.indexOfTodayButton == (NSInteger)index) { self.todayButton.frame = rect; } if (self.indexOfSelectedButton == (NSInteger)index) { self.selectedButton.frame = rect; } } - (void)selectColumnForDate:(NSDate *)date; { if (!date && self.indexOfSelectedButton == -1) { return; } NSInteger newIndexOfSelectedButton = -1; if (date) { NSInteger thisDayMonth = [self.calendar components:NSMonthCalendarUnit fromDate:date].month; if (self.monthOfBeginningDate == thisDayMonth) { newIndexOfSelectedButton = [self.calendar components:NSDayCalendarUnit fromDate:self.beginningDate toDate:date options:0].day; if (newIndexOfSelectedButton >= (NSInteger)self.daysInWeek) { newIndexOfSelectedButton = -1; } } } self.indexOfSelectedButton = newIndexOfSelectedButton; if (newIndexOfSelectedButton >= 0) { self.selectedButton.hidden = NO; NSString *newTitle = [self.dayButtons[newIndexOfSelectedButton] currentTitle]; [self.selectedButton setTitle:newTitle forState:UIControlStateNormal]; [self.selectedButton setTitle:newTitle forState:UIControlStateDisabled]; [self.selectedButton setAccessibilityLabel:[self.dayButtons[newIndexOfSelectedButton] accessibilityLabel]]; } else { self.selectedButton.hidden = YES; } [self setNeedsLayout]; } - (NSDateFormatter *)dayFormatter; { if (!_dayFormatter) { _dayFormatter = [NSDateFormatter new]; _dayFormatter.calendar = self.calendar; _dayFormatter.dateFormat = @"d"; } return _dayFormatter; } - (NSDateFormatter *)accessibilityFormatter; { if (!_accessibilityFormatter) { _accessibilityFormatter = [NSDateFormatter new]; _accessibilityFormatter.calendar = self.calendar; _accessibilityFormatter.dateStyle = NSDateFormatterLongStyle; } return _accessibilityFormatter; } - (NSInteger)monthOfBeginningDate; { if (!_monthOfBeginningDate) { _monthOfBeginningDate = [self.calendar components:NSMonthCalendarUnit fromDate:self.firstOfMonth].month; } return _monthOfBeginningDate; } - (void)setFirstOfMonth:(NSDate *)firstOfMonth; { [super setFirstOfMonth:firstOfMonth]; self.monthOfBeginningDate = 0; } - (NSDateComponents *)todayDateComponents; { if (!_todayDateComponents) { self.todayDateComponents = [self.calendar components:NSDayCalendarUnit|NSMonthCalendarUnit|NSYearCalendarUnit fromDate:[NSDate date]]; } return _todayDateComponents; } @end ================================================ FILE: TimesSquare/TSQCalendarView.h ================================================ // // TSQCalendarState.h // TimesSquare // // Created by Jim Puls on 11/14/12. // Licensed to Square, Inc. under one or more contributor license agreements. // See the LICENSE file distributed with this work for the terms under // which Square, Inc. licenses this file to you. #import @protocol TSQCalendarViewDelegate; /** The `TSQCalendarView` class displays a monthly calendar in a self-contained scrolling view. It supports any calendar that `NSCalendar` supports. The implementation and usage are very similar to `UITableView`: the app provides reusable cells via a data source and controls behavior via a delegate. See `TSQCalendarCell` for a cell superclass. */ @interface TSQCalendarView : UIView /** @name Date Setup */ /** The earliest month the calendar view displays. Set this property to any `NSDate`; `TSQCalendarView` will only look at the month and year. Must be set for the calendar to be useful. */ @property (nonatomic, strong) NSDate *firstDate; /** The latest month the calendar view displays. Set this property to any `NSDate`; `TSQCalendarView` will only look at the month and year. Must be set for the calendar to be useful. */ @property (nonatomic, strong) NSDate *lastDate; /** The currently-selected date on the calendar. Set this property to any `NSDate`; `TSQCalendarView` will only look at the month, day, and year. You can read and write this property; the delegate method `calendarView:didSelectDate:` will be called both when a new date is selected from the UI and when this method is called manually. */ @property (nonatomic, strong) NSDate *selectedDate; /** @name Calendar Configuration */ /** The calendar type to use when displaying. If not set, this defaults to `[NSCalendar currentCalendar]`. */ @property (nonatomic, strong) NSCalendar *calendar; /** @name Visual Configuration */ /** The delegate of the calendar view. The delegate must adopt the `TSQCalendarViewDelegate` protocol. The `TSQCalendarView` class, which does not retain the delegate, invokes each protocol method the delegate implements. */ @property (nonatomic, weak) id delegate; /** Whether to pin the header to the top of the view. If you're trying to emulate the built-in calendar app, set this to `YES`. Default value is `NO`. */ @property (nonatomic) BOOL pinsHeaderToTop; /** Whether or not the calendar snaps to begin a month at the top of its bounds. This property is roughly equivalent to the one defined on `UIScrollView` except the snapping is to months rather than integer multiples of the view's bounds. */ @property (nonatomic) BOOL pagingEnabled; /** The distance from the edges of the view to where the content begins. This property is equivalent to the one defined on `UIScrollView`. */ @property (nonatomic) UIEdgeInsets contentInset; /** The point on the calendar where the currently-visible region starts. This property is equivalent to the one defined on `UIScrollView`. */ @property (nonatomic) CGPoint contentOffset; /** The cell class to use for month headers. Since there's very little configuration to be done for each cell, this can be set as a shortcut to implementing a data source. The class should be a subclass of `TSQCalendarMonthHeaderCell` or at least implement all of its methods. */ @property (nonatomic, strong) Class headerCellClass; /** The cell class to use for week rows. Since there's very little configuration to be done for each cell, this can be set as a shortcut to implementing a data source. The class should be a subclass of `TSQCalendarRowCell` or at least implement all of its methods. */ @property (nonatomic, strong) Class rowCellClass; /** Scrolls the receiver until the specified date month is completely visible. @param date A date that identifies the month that will be visible. @param animated YES if you want to animate the change in position, NO if it should be immediate. */ - (void)scrollToDate:(NSDate *)date animated:(BOOL)animated; /** Scrolls the receiver until the specified date is at the specified position in the view. @param date A date that identifies the month that will be visible. @param position A UITableViewScroll Position, determining the position of the date after scroll is finished. @param animated YES if you want to animate the change in position, NO if it should be immediate. */ - (void)scrollDate:(NSDate *)date toPosition:(UITableViewScrollPosition)position animated:(BOOL)animated; @end /** The methods in the `TSQCalendarViewDelegate` protocol allow the adopting delegate to either prevent a day from being selected or respond to it. */ @protocol TSQCalendarViewDelegate @optional /** @name Responding to Selection */ /** Asks the delegate whether a particular date is selectable. This method should be relatively efficient, as it is called repeatedly to appropriate enable and disable individual days on the calendar view. @param calendarView The calendar view that is selecting a date. @param date Midnight on the date being selected. @return Whether or not the date is selectable. */ - (BOOL)calendarView:(TSQCalendarView *)calendarView shouldSelectDate:(NSDate *)date; /** Tells the delegate that a particular date was selected. @param calendarView The calendar view that is selecting a date. @param date Midnight on the date being selected. */ - (void)calendarView:(TSQCalendarView *)calendarView didSelectDate:(NSDate *)date; @end ================================================ FILE: TimesSquare/TSQCalendarView.m ================================================ // // TSQCalendarState.m // TimesSquare // // Created by Jim Puls on 11/14/12. // Licensed to Square, Inc. under one or more contributor license agreements. // See the LICENSE file distributed with this work for the terms under // which Square, Inc. licenses this file to you. #import "TSQCalendarView.h" #import "TSQCalendarMonthHeaderCell.h" #import "TSQCalendarRowCell.h" @interface TSQCalendarView () @property (nonatomic, strong) UITableView *tableView; @property (nonatomic, strong) TSQCalendarMonthHeaderCell *headerView; // nil unless pinsHeaderToTop == YES @end @implementation TSQCalendarView - (id)initWithCoder:(NSCoder *)aDecoder; { self = [super initWithCoder:aDecoder]; if (!self) { return nil; } [self _TSQCalendarView_commonInit]; return self; } - (id)initWithFrame:(CGRect)frame; { self = [super initWithFrame:frame]; if (!self) { return nil; } [self _TSQCalendarView_commonInit]; return self; } - (void)_TSQCalendarView_commonInit; { _tableView = [[UITableView alloc] initWithFrame:self.bounds style:UITableViewStylePlain]; _tableView.dataSource = self; _tableView.delegate = self; _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; _tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth; [self addSubview:_tableView]; } - (void)dealloc; { _tableView.dataSource = nil; _tableView.delegate = nil; } - (NSCalendar *)calendar; { if (!_calendar) { self.calendar = [NSCalendar currentCalendar]; } return _calendar; } - (Class)headerCellClass; { if (!_headerCellClass) { self.headerCellClass = [TSQCalendarMonthHeaderCell class]; } return _headerCellClass; } - (Class)rowCellClass; { if (!_rowCellClass) { self.rowCellClass = [TSQCalendarRowCell class]; } return _rowCellClass; } - (Class)cellClassForRowAtIndexPath:(NSIndexPath *)indexPath; { if (indexPath.row == 0 && !self.pinsHeaderToTop) { return [self headerCellClass]; } else { return [self rowCellClass]; } } - (void)setBackgroundColor:(UIColor *)backgroundColor; { [super setBackgroundColor:backgroundColor]; [self.tableView setBackgroundColor:backgroundColor]; } - (void)setPinsHeaderToTop:(BOOL)pinsHeaderToTop; { _pinsHeaderToTop = pinsHeaderToTop; [self setNeedsLayout]; } - (void)setFirstDate:(NSDate *)firstDate; { // clamp to the beginning of its month _firstDate = [self clampDate:firstDate toComponents:NSMonthCalendarUnit|NSYearCalendarUnit]; } - (void)setLastDate:(NSDate *)lastDate; { // clamp to the end of its month NSDate *firstOfMonth = [self clampDate:lastDate toComponents:NSMonthCalendarUnit|NSYearCalendarUnit]; NSDateComponents *offsetComponents = [[NSDateComponents alloc] init]; offsetComponents.month = 1; offsetComponents.day = -1; _lastDate = [self.calendar dateByAddingComponents:offsetComponents toDate:firstOfMonth options:0]; } - (void)setSelectedDate:(NSDate *)newSelectedDate; { // clamp to beginning of its day NSDate *startOfDay = [self clampDate:newSelectedDate toComponents:NSDayCalendarUnit|NSMonthCalendarUnit|NSYearCalendarUnit]; if ([self.delegate respondsToSelector:@selector(calendarView:shouldSelectDate:)] && ![self.delegate calendarView:self shouldSelectDate:startOfDay]) { return; } [[self cellForRowAtDate:_selectedDate] selectColumnForDate:nil]; [[self cellForRowAtDate:startOfDay] selectColumnForDate:startOfDay]; NSIndexPath *newIndexPath = [self indexPathForRowAtDate:startOfDay]; CGRect newIndexPathRect = [self.tableView rectForRowAtIndexPath:newIndexPath]; CGRect scrollBounds = self.tableView.bounds; if (self.pagingEnabled) { CGRect sectionRect = [self.tableView rectForSection:newIndexPath.section]; [self.tableView setContentOffset:sectionRect.origin animated:YES]; } else { if (CGRectGetMinY(scrollBounds) > CGRectGetMinY(newIndexPathRect)) { [self.tableView scrollToRowAtIndexPath:newIndexPath atScrollPosition:UITableViewScrollPositionTop animated:YES]; } else if (CGRectGetMaxY(scrollBounds) < CGRectGetMaxY(newIndexPathRect)) { [self.tableView scrollToRowAtIndexPath:newIndexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES]; } } _selectedDate = startOfDay; if ([self.delegate respondsToSelector:@selector(calendarView:didSelectDate:)]) { [self.delegate calendarView:self didSelectDate:startOfDay]; } } - (void)scrollToDate:(NSDate *)date animated:(BOOL)animated { NSInteger section = [self sectionForDate:date]; [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:section] atScrollPosition:UITableViewScrollPositionTop animated:animated]; } - (void)scrollDate:(NSDate *)date toPosition:(UITableViewScrollPosition)position animated:(BOOL)animated { NSIndexPath *cellPath = [self indexPathForRowAtDate:date]; [self.tableView scrollToRowAtIndexPath:cellPath atScrollPosition:position animated:animated]; } - (TSQCalendarMonthHeaderCell *)makeHeaderCellWithIdentifier:(NSString *)identifier; { TSQCalendarMonthHeaderCell *cell = [[[self headerCellClass] alloc] initWithCalendar:self.calendar reuseIdentifier:identifier]; cell.backgroundColor = self.backgroundColor; cell.calendarView = self; return cell; } #pragma mark Calendar calculations - (NSDate *)firstOfMonthForSection:(NSInteger)section; { NSDateComponents *offset = [NSDateComponents new]; offset.month = section; return [self.calendar dateByAddingComponents:offset toDate:self.firstDate options:0]; } - (TSQCalendarRowCell *)cellForRowAtDate:(NSDate *)date; { return (TSQCalendarRowCell *)[self.tableView cellForRowAtIndexPath:[self indexPathForRowAtDate:date]]; } - (NSInteger)sectionForDate:(NSDate *)date; { return [self.calendar components:NSMonthCalendarUnit fromDate:self.firstDate toDate:date options:0].month; } - (NSIndexPath *)indexPathForRowAtDate:(NSDate *)date; { if (!date) { return nil; } NSInteger section = [self sectionForDate:date]; NSDate *firstOfMonth = [self firstOfMonthForSection:section]; NSInteger firstWeek = [self.calendar components:NSWeekOfMonthCalendarUnit fromDate:firstOfMonth].weekOfMonth; NSInteger targetWeek = [self.calendar components:NSWeekOfMonthCalendarUnit fromDate:date].weekOfMonth; return [NSIndexPath indexPathForRow:(self.pinsHeaderToTop ? 0 : 1) + targetWeek - firstWeek inSection:section]; } #pragma mark UIView - (void)layoutSubviews; { if (self.pinsHeaderToTop) { if (!self.headerView) { self.headerView = [self makeHeaderCellWithIdentifier:nil]; if (self.tableView.visibleCells.count > 0) { self.headerView.firstOfMonth = [self.tableView.visibleCells[0] firstOfMonth]; } else { self.headerView.firstOfMonth = self.firstDate; } [self addSubview:self.headerView]; } CGRect bounds = self.bounds; CGRect headerRect; CGRect tableRect; CGRectDivide(bounds, &headerRect, &tableRect, [[self headerCellClass] cellHeight], CGRectMinYEdge); self.headerView.frame = headerRect; self.tableView.frame = tableRect; } else { if (self.headerView) { [self.headerView removeFromSuperview]; self.headerView = nil; } self.tableView.frame = self.bounds; } } #pragma mark UITableViewDataSource - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView; { return 1 + [self.calendar components:NSMonthCalendarUnit fromDate:self.firstDate toDate:self.lastDate options:0].month; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section; { NSDate *firstOfMonth = [self firstOfMonthForSection:section]; NSRange rangeOfWeeks = [self.calendar rangeOfUnit:NSWeekCalendarUnit inUnit:NSMonthCalendarUnit forDate:firstOfMonth]; return (self.pinsHeaderToTop ? 0 : 1) + rangeOfWeeks.length; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; { if (indexPath.row == 0 && !self.pinsHeaderToTop) { // month header static NSString *identifier = @"header"; TSQCalendarMonthHeaderCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier]; if (!cell) { cell = [self makeHeaderCellWithIdentifier:identifier]; } return cell; } else { static NSString *identifier = @"row"; TSQCalendarRowCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier]; if (!cell) { cell = [[[self rowCellClass] alloc] initWithCalendar:self.calendar reuseIdentifier:identifier]; cell.backgroundColor = self.backgroundColor; cell.calendarView = self; } return cell; } } #pragma mark UITableViewDelegate - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath; { NSDate *firstOfMonth = [self firstOfMonthForSection:indexPath.section]; [(TSQCalendarCell *)cell setFirstOfMonth:firstOfMonth]; if (indexPath.row > 0 || self.pinsHeaderToTop) { NSInteger ordinalityOfFirstDay = [self.calendar ordinalityOfUnit:NSDayCalendarUnit inUnit:NSWeekCalendarUnit forDate:firstOfMonth]; NSDateComponents *dateComponents = [NSDateComponents new]; dateComponents.day = 1 - ordinalityOfFirstDay; dateComponents.week = indexPath.row - (self.pinsHeaderToTop ? 0 : 1); [(TSQCalendarRowCell *)cell setBeginningDate:[self.calendar dateByAddingComponents:dateComponents toDate:firstOfMonth options:0]]; [(TSQCalendarRowCell *)cell selectColumnForDate:self.selectedDate]; BOOL isBottomRow = (indexPath.row == [self tableView:tableView numberOfRowsInSection:indexPath.section] - (self.pinsHeaderToTop ? 0 : 1)); [(TSQCalendarRowCell *)cell setBottomRow:isBottomRow]; } } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath; { return [[self cellClassForRowAtIndexPath:indexPath] cellHeight]; } #pragma mark UIScrollViewDelegate - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset; { if (self.pagingEnabled) { NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:*targetContentOffset]; // If the target offset is at the third row or later, target the next month; otherwise, target the beginning of this month. NSInteger section = indexPath.section; if (indexPath.row > 2) { section++; } CGRect sectionRect = [self.tableView rectForSection:section]; *targetContentOffset = sectionRect.origin; } } - (void)scrollViewDidScroll:(UIScrollView *)scrollView; { if (self.pinsHeaderToTop && self.tableView.visibleCells.count > 0) { TSQCalendarCell *cell = self.tableView.visibleCells[0]; self.headerView.firstOfMonth = cell.firstOfMonth; } } - (NSDate *)clampDate:(NSDate *)date toComponents:(NSUInteger)unitFlags { NSDateComponents *components = [self.calendar components:unitFlags fromDate:date]; return [self.calendar dateFromComponents:components]; } @end ================================================ FILE: TimesSquare/TimesSquare-Prefix.pch ================================================ // // Prefix header for all source files of the 'TimesSquare' target in the 'TimesSquare' project // #ifdef __OBJC__ #import #endif ================================================ FILE: TimesSquare/TimesSquare.h ================================================ // // TimesSquare.h // TimesSquare // // Created by Jim Puls on 12/5/12. // Licensed to Square, Inc. under one or more contributor license agreements. // See the LICENSE file distributed with this work for the terms under // which Square, Inc. licenses this file to you. #import #import #import ================================================ FILE: TimesSquare.podspec ================================================ Pod::Spec.new do |s| s.name = "TimesSquare" s.version = "1.0.2" s.summary = "TimesSquare is an Objective-C calendar view for your apps." s.homepage = "https://github.com/square/objc-TimesSquare" s.license = 'Apache License, Version 2.0' s.author = { "Square" => "http://squareup.com" } s.source = { :git => "https://github.com/square/objc-TimesSquare.git", :branch => "master", :tag => s.version.to_s } s.platform = :ios, '5.0' s.source_files = 'TimesSquare/*.{h,m}' s.requires_arc = true end ================================================ FILE: TimesSquare.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ A806805F16700FD70071C71E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A806805E16700FD70071C71E /* Foundation.framework */; }; A806808E167010030071C71E /* TSQCalendarCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A8068087167010030071C71E /* TSQCalendarCell.m */; }; A8068090167010030071C71E /* TSQCalendarMonthHeaderCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A8068089167010030071C71E /* TSQCalendarMonthHeaderCell.m */; }; A8068092167010030071C71E /* TSQCalendarRowCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A806808B167010030071C71E /* TSQCalendarRowCell.m */; }; A8068094167010030071C71E /* TSQCalendarView.m in Sources */ = {isa = PBXBuildFile; fileRef = A806808D167010030071C71E /* TSQCalendarView.m */; }; A80B62AB1672720C00792DFE /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A806809E167012980071C71E /* CoreGraphics.framework */; }; EFD8DE6D167AF77B00F87FBE /* TimesSquare.h in Headers */ = {isa = PBXBuildFile; fileRef = A806806316700FD70071C71E /* TimesSquare.h */; settings = {ATTRIBUTES = (Public, ); }; }; EFD8DE6E167AF78100F87FBE /* TSQCalendarCell.h in Headers */ = {isa = PBXBuildFile; fileRef = A8068086167010030071C71E /* TSQCalendarCell.h */; settings = {ATTRIBUTES = (Public, ); }; }; EFD8DE6F167AF78600F87FBE /* TSQCalendarMonthHeaderCell.h in Headers */ = {isa = PBXBuildFile; fileRef = A8068088167010030071C71E /* TSQCalendarMonthHeaderCell.h */; settings = {ATTRIBUTES = (Public, ); }; }; EFD8DE70167AF78C00F87FBE /* TSQCalendarRowCell.h in Headers */ = {isa = PBXBuildFile; fileRef = A806808A167010030071C71E /* TSQCalendarRowCell.h */; settings = {ATTRIBUTES = (Public, ); }; }; EFD8DE71167AF79000F87FBE /* TSQCalendarView.h in Headers */ = {isa = PBXBuildFile; fileRef = A806808C167010030071C71E /* TSQCalendarView.h */; settings = {ATTRIBUTES = (Public, ); }; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ A806805916700FD70071C71E /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = "include/${PRODUCT_NAME}"; dstSubfolderSpec = 16; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ A806805B16700FD70071C71E /* libTimesSquare.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libTimesSquare.a; sourceTree = BUILT_PRODUCTS_DIR; }; A806805E16700FD70071C71E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; A806806216700FD70071C71E /* TimesSquare-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TimesSquare-Prefix.pch"; sourceTree = ""; }; A806806316700FD70071C71E /* TimesSquare.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TimesSquare.h; sourceTree = ""; }; A806806D16700FD80071C71E /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; }; A806806F16700FD80071C71E /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; A8068086167010030071C71E /* TSQCalendarCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSQCalendarCell.h; sourceTree = ""; }; A8068087167010030071C71E /* TSQCalendarCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSQCalendarCell.m; sourceTree = ""; }; A8068088167010030071C71E /* TSQCalendarMonthHeaderCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSQCalendarMonthHeaderCell.h; sourceTree = ""; }; A8068089167010030071C71E /* TSQCalendarMonthHeaderCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSQCalendarMonthHeaderCell.m; sourceTree = ""; }; A806808A167010030071C71E /* TSQCalendarRowCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSQCalendarRowCell.h; sourceTree = ""; }; A806808B167010030071C71E /* TSQCalendarRowCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSQCalendarRowCell.m; sourceTree = ""; }; A806808C167010030071C71E /* TSQCalendarView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSQCalendarView.h; sourceTree = ""; }; A806808D167010030071C71E /* TSQCalendarView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSQCalendarView.m; sourceTree = ""; }; A806809E167012980071C71E /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ A806805816700FD70071C71E /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( A80B62AB1672720C00792DFE /* CoreGraphics.framework in Frameworks */, A806805F16700FD70071C71E /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ A806805016700FD70071C71E = { isa = PBXGroup; children = ( A806806016700FD70071C71E /* TimesSquare */, A806805D16700FD70071C71E /* Frameworks */, A806805C16700FD70071C71E /* Products */, ); sourceTree = ""; }; A806805C16700FD70071C71E /* Products */ = { isa = PBXGroup; children = ( A806805B16700FD70071C71E /* libTimesSquare.a */, ); name = Products; sourceTree = ""; }; A806805D16700FD70071C71E /* Frameworks */ = { isa = PBXGroup; children = ( A806805E16700FD70071C71E /* Foundation.framework */, A806806D16700FD80071C71E /* SenTestingKit.framework */, A806806F16700FD80071C71E /* UIKit.framework */, A806809E167012980071C71E /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = ""; }; A806806016700FD70071C71E /* TimesSquare */ = { isa = PBXGroup; children = ( A806806316700FD70071C71E /* TimesSquare.h */, A8068086167010030071C71E /* TSQCalendarCell.h */, A8068087167010030071C71E /* TSQCalendarCell.m */, A8068088167010030071C71E /* TSQCalendarMonthHeaderCell.h */, A8068089167010030071C71E /* TSQCalendarMonthHeaderCell.m */, A806808A167010030071C71E /* TSQCalendarRowCell.h */, A806808B167010030071C71E /* TSQCalendarRowCell.m */, A806808C167010030071C71E /* TSQCalendarView.h */, A806808D167010030071C71E /* TSQCalendarView.m */, A806806116700FD70071C71E /* Supporting Files */, ); path = TimesSquare; sourceTree = ""; }; A806806116700FD70071C71E /* Supporting Files */ = { isa = PBXGroup; children = ( A806806216700FD70071C71E /* TimesSquare-Prefix.pch */, ); name = "Supporting Files"; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ EFD8DE6B167AF77100F87FBE /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( EFD8DE6D167AF77B00F87FBE /* TimesSquare.h in Headers */, EFD8DE6E167AF78100F87FBE /* TSQCalendarCell.h in Headers */, EFD8DE6F167AF78600F87FBE /* TSQCalendarMonthHeaderCell.h in Headers */, EFD8DE70167AF78C00F87FBE /* TSQCalendarRowCell.h in Headers */, EFD8DE71167AF79000F87FBE /* TSQCalendarView.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXLegacyTarget section */ A81E05F71682A0E000E79A2B /* TimesSquare Documentation */ = { isa = PBXLegacyTarget; buildArgumentsString = "--exit-threshold 2 --logformat xcode --output /tmp/tsq-docs --project-name TimesSquare --project-version 1.0 --project-company \"Square, Inc.\" --company-id com.squareup --no-repeat-first-par --no-search-undocumented-doc TimesSquare/"; buildConfigurationList = A81E05F81682A0E000E79A2B /* Build configuration list for PBXLegacyTarget "TimesSquare Documentation" */; buildPhases = ( ); buildToolPath = /usr/local/bin/appledoc; buildWorkingDirectory = ""; dependencies = ( ); name = "TimesSquare Documentation"; passBuildSettingsInEnvironment = 0; productName = "TimesSquare Documentation"; }; /* End PBXLegacyTarget section */ /* Begin PBXNativeTarget section */ A806805A16700FD70071C71E /* TimesSquare */ = { isa = PBXNativeTarget; buildConfigurationList = A806808016700FD80071C71E /* Build configuration list for PBXNativeTarget "TimesSquare" */; buildPhases = ( EFD8DE6B167AF77100F87FBE /* Headers */, A806805716700FD70071C71E /* Sources */, A806805816700FD70071C71E /* Frameworks */, A806805916700FD70071C71E /* CopyFiles */, ); buildRules = ( ); dependencies = ( ); name = TimesSquare; productName = PonyDate; productReference = A806805B16700FD70071C71E /* libTimesSquare.a */; productType = "com.apple.product-type.library.static"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ A806805216700FD70071C71E /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0640; ORGANIZATIONNAME = Square; }; buildConfigurationList = A806805516700FD70071C71E /* Build configuration list for PBXProject "TimesSquare" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = A806805016700FD70071C71E; productRefGroup = A806805C16700FD70071C71E /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( A806805A16700FD70071C71E /* TimesSquare */, A81E05F71682A0E000E79A2B /* TimesSquare Documentation */, ); }; /* End PBXProject section */ /* Begin PBXSourcesBuildPhase section */ A806805716700FD70071C71E /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( A806808E167010030071C71E /* TSQCalendarCell.m in Sources */, A8068090167010030071C71E /* TSQCalendarMonthHeaderCell.m in Sources */, A8068092167010030071C71E /* TSQCalendarRowCell.m in Sources */, A8068094167010030071C71E /* TSQCalendarView.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ A806807E16700FD80071C71E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_PEDANTIC = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 5.0; ONLY_ACTIVE_ARCH = YES; PUBLIC_HEADERS_FOLDER_PATH = "include/$(PRODUCT_NAME)"; RUN_CLANG_STATIC_ANALYZER = YES; SDKROOT = iphoneos; }; name = Debug; }; A806807F16700FD80071C71E /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_PEDANTIC = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 5.0; PUBLIC_HEADERS_FOLDER_PATH = "include/$(PRODUCT_NAME)"; RUN_CLANG_STATIC_ANALYZER = YES; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; }; name = Release; }; A806808116700FD80071C71E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_OBJC_ARC = YES; DSTROOT = /tmp/TimesSquare.dst; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "TimesSquare/TimesSquare-Prefix.pch"; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; }; name = Debug; }; A806808216700FD80071C71E /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_OBJC_ARC = YES; DSTROOT = /tmp/TimesSquare.dst; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "TimesSquare/TimesSquare-Prefix.pch"; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; }; name = Release; }; A81E05F91682A0E000E79A2B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { DEBUGGING_SYMBOLS = YES; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; MACOSX_DEPLOYMENT_TARGET = 10.8; OTHER_CFLAGS = ""; OTHER_LDFLAGS = ""; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; }; name = Debug; }; A81E05FA1682A0E000E79A2B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; MACOSX_DEPLOYMENT_TARGET = 10.8; OTHER_CFLAGS = ""; OTHER_LDFLAGS = ""; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ A806805516700FD70071C71E /* Build configuration list for PBXProject "TimesSquare" */ = { isa = XCConfigurationList; buildConfigurations = ( A806807E16700FD80071C71E /* Debug */, A806807F16700FD80071C71E /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; A806808016700FD80071C71E /* Build configuration list for PBXNativeTarget "TimesSquare" */ = { isa = XCConfigurationList; buildConfigurations = ( A806808116700FD80071C71E /* Debug */, A806808216700FD80071C71E /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; A81E05F81682A0E000E79A2B /* Build configuration list for PBXLegacyTarget "TimesSquare Documentation" */ = { isa = XCConfigurationList; buildConfigurations = ( A81E05F91682A0E000E79A2B /* Debug */, A81E05FA1682A0E000E79A2B /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = A806805216700FD70071C71E /* Project object */; } ================================================ FILE: TimesSquare.xcodeproj/xcshareddata/xcschemes/TimesSquare Documentation.xcscheme ================================================ ================================================ FILE: TimesSquare.xcodeproj/xcshareddata/xcschemes/TimesSquare.xcscheme ================================================ ================================================ FILE: TimesSquareTestApp/TSQTAAppDelegate.h ================================================ // // TSQTAAppDelegate.h // TimesSquareTestApp // // Created by Jim Puls on 12/5/12. // Licensed to Square, Inc. under one or more contributor license agreements. // See the LICENSE file distributed with this work for the terms under // which Square, Inc. licenses this file to you. #import @interface TSQTAAppDelegate : UIResponder @property (strong, nonatomic) UIWindow *window; @end ================================================ FILE: TimesSquareTestApp/TSQTAAppDelegate.m ================================================ // // TSQTAAppDelegate.m // TimesSquareTestApp // // Created by Jim Puls on 12/5/12. // Licensed to Square, Inc. under one or more contributor license agreements. // See the LICENSE file distributed with this work for the terms under // which Square, Inc. licenses this file to you. #import "TSQTAAppDelegate.h" #import "TSQTAViewController.h" @implementation TSQTAAppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; TSQTAViewController *gregorian = [[TSQTAViewController alloc] init]; gregorian.calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; gregorian.calendar.locale = [NSLocale currentLocale]; TSQTAViewController *hebrew = [[TSQTAViewController alloc] init]; hebrew.calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSHebrewCalendar]; hebrew.calendar.locale = [NSLocale currentLocale]; TSQTAViewController *islamic = [[TSQTAViewController alloc] init]; islamic.calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSIslamicCalendar]; islamic.calendar.locale = [NSLocale currentLocale]; TSQTAViewController *indian = [[TSQTAViewController alloc] init]; indian.calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSIndianCalendar]; indian.calendar.locale = [NSLocale currentLocale]; TSQTAViewController *persian = [[TSQTAViewController alloc] init]; persian.calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSPersianCalendar]; persian.calendar.locale = [NSLocale currentLocale]; UITabBarController *tabController = [[UITabBarController alloc] init]; tabController.viewControllers = @[gregorian, hebrew, islamic, indian, persian]; self.window.rootViewController = tabController; [self.window makeKeyAndVisible]; return YES; } @end ================================================ FILE: TimesSquareTestApp/TSQTACalendarRowCell.h ================================================ // // TSQTACalendarRowCell.h // TimesSquare // // Created by Jim Puls on 12/5/12. // Licensed to Square, Inc. under one or more contributor license agreements. // See the LICENSE file distributed with this work for the terms under // which Square, Inc. licenses this file to you. #import @interface TSQTACalendarRowCell : TSQCalendarRowCell @end ================================================ FILE: TimesSquareTestApp/TSQTACalendarRowCell.m ================================================ // // TSQTACalendarRowCell.m // TimesSquare // // Created by Jim Puls on 12/5/12. // Licensed to Square, Inc. under one or more contributor license agreements. // See the LICENSE file distributed with this work for the terms under // which Square, Inc. licenses this file to you. #import "TSQTACalendarRowCell.h" @implementation TSQTACalendarRowCell - (void)layoutViewsForColumnAtIndex:(NSUInteger)index inRect:(CGRect)rect; { // Move down for the row at the top rect.origin.y += self.columnSpacing; rect.size.height -= (self.bottomRow ? 2.0f : 1.0f) * self.columnSpacing; [super layoutViewsForColumnAtIndex:index inRect:rect]; } - (UIImage *)todayBackgroundImage; { return [[UIImage imageNamed:@"CalendarTodaysDate.png"] stretchableImageWithLeftCapWidth:4 topCapHeight:4]; } - (UIImage *)selectedBackgroundImage; { return [[UIImage imageNamed:@"CalendarSelectedDate.png"] stretchableImageWithLeftCapWidth:4 topCapHeight:4]; } - (UIImage *)notThisMonthBackgroundImage; { return [[UIImage imageNamed:@"CalendarPreviousMonth.png"] stretchableImageWithLeftCapWidth:0 topCapHeight:0]; } - (UIImage *)backgroundImage; { return [UIImage imageNamed:[NSString stringWithFormat:@"CalendarRow%@.png", self.bottomRow ? @"Bottom" : @""]]; } @end ================================================ FILE: TimesSquareTestApp/TSQTAViewController.h ================================================ // // TSQTAViewController.h // TimesSquare // // Created by Jim Puls on 12/5/12. // Licensed to Square, Inc. under one or more contributor license agreements. // See the LICENSE file distributed with this work for the terms under // which Square, Inc. licenses this file to you. #import @interface TSQTAViewController : UIViewController @property (nonatomic, strong) NSCalendar *calendar; @end ================================================ FILE: TimesSquareTestApp/TSQTAViewController.m ================================================ // // TSQTAViewController.m // TimesSquare // // Created by Jim Puls on 12/5/12. // Licensed to Square, Inc. under one or more contributor license agreements. // See the LICENSE file distributed with this work for the terms under // which Square, Inc. licenses this file to you. #import "TSQTAViewController.h" #import "TSQTACalendarRowCell.h" #import @interface TSQTAViewController () @property (nonatomic, retain) NSTimer *timer; @end @interface TSQCalendarView (AccessingPrivateStuff) @property (nonatomic, readonly) UITableView *tableView; @end @implementation TSQTAViewController - (void)loadView; { TSQCalendarView *calendarView = [[TSQCalendarView alloc] init]; calendarView.calendar = self.calendar; calendarView.rowCellClass = [TSQTACalendarRowCell class]; calendarView.firstDate = [NSDate dateWithTimeIntervalSinceNow:-60 * 60 * 24 * 365 * 1]; calendarView.lastDate = [NSDate dateWithTimeIntervalSinceNow:60 * 60 * 24 * 365 * 5]; calendarView.backgroundColor = [UIColor colorWithRed:0.84f green:0.85f blue:0.86f alpha:1.0f]; calendarView.pagingEnabled = YES; CGFloat onePixel = 1.0f / [UIScreen mainScreen].scale; calendarView.contentInset = UIEdgeInsetsMake(0.0f, onePixel, 0.0f, onePixel); self.view = calendarView; } - (void)setCalendar:(NSCalendar *)calendar; { _calendar = calendar; self.navigationItem.title = calendar.calendarIdentifier; self.tabBarItem.title = calendar.calendarIdentifier; } - (void)viewDidLayoutSubviews; { // Set the calendar view to show today date on start [(TSQCalendarView *)self.view scrollToDate:[NSDate date] animated:NO]; } - (void)viewDidAppear:(BOOL)animated; { [super viewDidAppear:animated]; // Uncomment this to test scrolling performance of your custom drawing // self.timer = [NSTimer scheduledTimerWithTimeInterval:.1 target:self selector:@selector(scroll) userInfo:nil repeats:YES]; } - (void)viewWillDisappear:(BOOL)animated; { [self.timer invalidate]; self.timer = nil; } - (void)scroll; { static BOOL atTop = YES; TSQCalendarView *calendarView = (TSQCalendarView *)self.view; UITableView *tableView = calendarView.tableView; [tableView setContentOffset:CGPointMake(0.f, atTop ? 10000.f : 0.f) animated:YES]; atTop = !atTop; } @end ================================================ FILE: TimesSquareTestApp/TimesSquareTestApp-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier com.squareup.${PRODUCT_NAME:rfc1034identifier} CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1.0 LSRequiresIPhoneOS UIRequiredDeviceCapabilities armv7 UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: TimesSquareTestApp/TimesSquareTestApp-Prefix.pch ================================================ // // Prefix header for all source files of the 'TimesSquareTestApp' target in the 'TimesSquareTestApp' project // #import #ifndef __IPHONE_3_0 #warning "This project uses features only available in iOS SDK 3.0 and later." #endif #ifdef __OBJC__ #import #import #endif ================================================ FILE: TimesSquareTestApp/TimesSquareTestApp.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ A885A9771694FCDD00CA6E1B /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A885A9761694FCDD00CA6E1B /* UIKit.framework */; }; A885A9791694FCDD00CA6E1B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A885A9781694FCDD00CA6E1B /* Foundation.framework */; }; A885A97B1694FCDD00CA6E1B /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A885A97A1694FCDD00CA6E1B /* CoreGraphics.framework */; }; A885A9951694FCDD00CA6E1B /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A885A9941694FCDD00CA6E1B /* SenTestingKit.framework */; }; A885A9961694FCDD00CA6E1B /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A885A9761694FCDD00CA6E1B /* UIKit.framework */; }; A885A9971694FCDD00CA6E1B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A885A9781694FCDD00CA6E1B /* Foundation.framework */; }; A885A99F1694FCDD00CA6E1B /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = A885A99D1694FCDD00CA6E1B /* InfoPlist.strings */; }; A885A9A21694FCDD00CA6E1B /* TimesSquareTestAppTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A885A9A11694FCDD00CA6E1B /* TimesSquareTestAppTests.m */; }; A885A9B61694FD5400CA6E1B /* TSQTAAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A885A9681694FC8A00CA6E1B /* TSQTAAppDelegate.m */; }; A885A9B81694FD5400CA6E1B /* TSQTACalendarRowCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A885A96A1694FC8A00CA6E1B /* TSQTACalendarRowCell.m */; }; A885A9BA1694FD5400CA6E1B /* TSQTAViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A885A96C1694FC8A00CA6E1B /* TSQTAViewController.m */; }; A885A9BB1694FDE000CA6E1B /* CalendarPreviousMonth.png in Resources */ = {isa = PBXBuildFile; fileRef = A885A9541694FC8A00CA6E1B /* CalendarPreviousMonth.png */; }; A885A9BC1694FDE000CA6E1B /* CalendarPreviousMonth@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A885A9551694FC8A00CA6E1B /* CalendarPreviousMonth@2x.png */; }; A885A9BD1694FDE000CA6E1B /* CalendarRow.png in Resources */ = {isa = PBXBuildFile; fileRef = A885A9561694FC8A00CA6E1B /* CalendarRow.png */; }; A885A9BE1694FDE000CA6E1B /* CalendarRow@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A885A9571694FC8A00CA6E1B /* CalendarRow@2x.png */; }; A885A9BF1694FDE000CA6E1B /* CalendarRowBottom.png in Resources */ = {isa = PBXBuildFile; fileRef = A885A9581694FC8A00CA6E1B /* CalendarRowBottom.png */; }; A885A9C01694FDE000CA6E1B /* CalendarRowBottom@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A885A9591694FC8A00CA6E1B /* CalendarRowBottom@2x.png */; }; A885A9C11694FDE000CA6E1B /* CalendarSelectedDate.png in Resources */ = {isa = PBXBuildFile; fileRef = A885A95A1694FC8A00CA6E1B /* CalendarSelectedDate.png */; }; A885A9C21694FDE000CA6E1B /* CalendarSelectedDate@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A885A95B1694FC8A00CA6E1B /* CalendarSelectedDate@2x.png */; }; A885A9C31694FDE000CA6E1B /* CalendarTodaysDate.png in Resources */ = {isa = PBXBuildFile; fileRef = A885A95C1694FC8A00CA6E1B /* CalendarTodaysDate.png */; }; A885A9C41694FDE000CA6E1B /* CalendarTodaysDate@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A885A95D1694FC8A00CA6E1B /* CalendarTodaysDate@2x.png */; }; A885A9C51694FDE000CA6E1B /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A885A95E1694FC8A00CA6E1B /* Default-568h@2x.png */; }; A885A9C61694FDE000CA6E1B /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = A885A95F1694FC8A00CA6E1B /* Default.png */; }; A885A9C71694FDE000CA6E1B /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A885A9601694FC8A00CA6E1B /* Default@2x.png */; }; A885A9C81694FDE400CA6E1B /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = A885A9621694FC8A00CA6E1B /* InfoPlist.strings */; }; A885A9C91694FEDA00CA6E1B /* libTimesSquare.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A885A9B21694FD3900CA6E1B /* libTimesSquare.a */; }; A885AA841695023500CA6E1B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = A885A9641694FC8A00CA6E1B /* main.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ A885A9981694FCDD00CA6E1B /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = A885A9481694FC4500CA6E1B /* Project object */; proxyType = 1; remoteGlobalIDString = A885A9721694FCDD00CA6E1B; remoteInfo = TimesSquareTestApp; }; A885A9B11694FD3900CA6E1B /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = A885A9A91694FD3900CA6E1B /* TimesSquare.xcodeproj */; proxyType = 2; remoteGlobalIDString = A806805B16700FD70071C71E; remoteInfo = TimesSquare; }; A885A9B31694FD4700CA6E1B /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = A885A9A91694FD3900CA6E1B /* TimesSquare.xcodeproj */; proxyType = 1; remoteGlobalIDString = A806805A16700FD70071C71E; remoteInfo = TimesSquare; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ A885A9541694FC8A00CA6E1B /* CalendarPreviousMonth.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = CalendarPreviousMonth.png; sourceTree = ""; }; A885A9551694FC8A00CA6E1B /* CalendarPreviousMonth@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "CalendarPreviousMonth@2x.png"; sourceTree = ""; }; A885A9561694FC8A00CA6E1B /* CalendarRow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = CalendarRow.png; sourceTree = ""; }; A885A9571694FC8A00CA6E1B /* CalendarRow@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "CalendarRow@2x.png"; sourceTree = ""; }; A885A9581694FC8A00CA6E1B /* CalendarRowBottom.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = CalendarRowBottom.png; sourceTree = ""; }; A885A9591694FC8A00CA6E1B /* CalendarRowBottom@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "CalendarRowBottom@2x.png"; sourceTree = ""; }; A885A95A1694FC8A00CA6E1B /* CalendarSelectedDate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = CalendarSelectedDate.png; sourceTree = ""; }; A885A95B1694FC8A00CA6E1B /* CalendarSelectedDate@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "CalendarSelectedDate@2x.png"; sourceTree = ""; }; A885A95C1694FC8A00CA6E1B /* CalendarTodaysDate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = CalendarTodaysDate.png; sourceTree = ""; }; A885A95D1694FC8A00CA6E1B /* CalendarTodaysDate@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "CalendarTodaysDate@2x.png"; sourceTree = ""; }; A885A95E1694FC8A00CA6E1B /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; A885A95F1694FC8A00CA6E1B /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; A885A9601694FC8A00CA6E1B /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; A885A9631694FC8A00CA6E1B /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = InfoPlist.strings; sourceTree = ""; }; A885A9641694FC8A00CA6E1B /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; A885A9651694FC8A00CA6E1B /* TimesSquareTestApp-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TimesSquareTestApp-Info.plist"; sourceTree = ""; }; A885A9661694FC8A00CA6E1B /* TimesSquareTestApp-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TimesSquareTestApp-Prefix.pch"; sourceTree = ""; }; A885A9671694FC8A00CA6E1B /* TSQTAAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TSQTAAppDelegate.h; sourceTree = ""; }; A885A9681694FC8A00CA6E1B /* TSQTAAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TSQTAAppDelegate.m; sourceTree = ""; }; A885A9691694FC8A00CA6E1B /* TSQTACalendarRowCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TSQTACalendarRowCell.h; sourceTree = ""; }; A885A96A1694FC8A00CA6E1B /* TSQTACalendarRowCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TSQTACalendarRowCell.m; sourceTree = ""; }; A885A96B1694FC8A00CA6E1B /* TSQTAViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TSQTAViewController.h; sourceTree = ""; }; A885A96C1694FC8A00CA6E1B /* TSQTAViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TSQTAViewController.m; sourceTree = ""; }; A885A9731694FCDD00CA6E1B /* TimesSquareTestApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TimesSquareTestApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; A885A9761694FCDD00CA6E1B /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; A885A9781694FCDD00CA6E1B /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; A885A97A1694FCDD00CA6E1B /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; }; A885A9931694FCDD00CA6E1B /* TimesSquareTestAppTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TimesSquareTestAppTests.octest; sourceTree = BUILT_PRODUCTS_DIR; }; A885A9941694FCDD00CA6E1B /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; }; A885A99C1694FCDD00CA6E1B /* TimesSquareTestAppTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TimesSquareTestAppTests-Info.plist"; sourceTree = ""; }; A885A99E1694FCDD00CA6E1B /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; A885A9A01694FCDD00CA6E1B /* TimesSquareTestAppTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TimesSquareTestAppTests.h; sourceTree = ""; }; A885A9A11694FCDD00CA6E1B /* TimesSquareTestAppTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TimesSquareTestAppTests.m; sourceTree = ""; }; A885A9A91694FD3900CA6E1B /* TimesSquare.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = TimesSquare.xcodeproj; path = ../TimesSquare.xcodeproj; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ A885A9701694FCDD00CA6E1B /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( A885A9C91694FEDA00CA6E1B /* libTimesSquare.a in Frameworks */, A885A9771694FCDD00CA6E1B /* UIKit.framework in Frameworks */, A885A9791694FCDD00CA6E1B /* Foundation.framework in Frameworks */, A885A97B1694FCDD00CA6E1B /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; A885A98F1694FCDD00CA6E1B /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( A885A9951694FCDD00CA6E1B /* SenTestingKit.framework in Frameworks */, A885A9961694FCDD00CA6E1B /* UIKit.framework in Frameworks */, A885A9971694FCDD00CA6E1B /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ A885A9461694FC4500CA6E1B = { isa = PBXGroup; children = ( A885A9521694FC7100CA6E1B /* App */, A885A99A1694FCDD00CA6E1B /* Tests */, A885A96E1694FCC000CA6E1B /* Frameworks */, A885A9741694FCDD00CA6E1B /* Products */, ); sourceTree = ""; }; A885A9521694FC7100CA6E1B /* App */ = { isa = PBXGroup; children = ( A885A96D1694FCA700CA6E1B /* Resources */, A885A9641694FC8A00CA6E1B /* main.m */, A885A9651694FC8A00CA6E1B /* TimesSquareTestApp-Info.plist */, A885A9661694FC8A00CA6E1B /* TimesSquareTestApp-Prefix.pch */, A885A9671694FC8A00CA6E1B /* TSQTAAppDelegate.h */, A885A9681694FC8A00CA6E1B /* TSQTAAppDelegate.m */, A885A9691694FC8A00CA6E1B /* TSQTACalendarRowCell.h */, A885A96A1694FC8A00CA6E1B /* TSQTACalendarRowCell.m */, A885A96B1694FC8A00CA6E1B /* TSQTAViewController.h */, A885A96C1694FC8A00CA6E1B /* TSQTAViewController.m */, ); name = App; sourceTree = SOURCE_ROOT; }; A885A96D1694FCA700CA6E1B /* Resources */ = { isa = PBXGroup; children = ( A885A9621694FC8A00CA6E1B /* InfoPlist.strings */, A885A9541694FC8A00CA6E1B /* CalendarPreviousMonth.png */, A885A9551694FC8A00CA6E1B /* CalendarPreviousMonth@2x.png */, A885A9561694FC8A00CA6E1B /* CalendarRow.png */, A885A9571694FC8A00CA6E1B /* CalendarRow@2x.png */, A885A9581694FC8A00CA6E1B /* CalendarRowBottom.png */, A885A9591694FC8A00CA6E1B /* CalendarRowBottom@2x.png */, A885A95A1694FC8A00CA6E1B /* CalendarSelectedDate.png */, A885A95B1694FC8A00CA6E1B /* CalendarSelectedDate@2x.png */, A885A95C1694FC8A00CA6E1B /* CalendarTodaysDate.png */, A885A95D1694FC8A00CA6E1B /* CalendarTodaysDate@2x.png */, A885A95E1694FC8A00CA6E1B /* Default-568h@2x.png */, A885A95F1694FC8A00CA6E1B /* Default.png */, A885A9601694FC8A00CA6E1B /* Default@2x.png */, ); name = Resources; sourceTree = ""; }; A885A96E1694FCC000CA6E1B /* Frameworks */ = { isa = PBXGroup; children = ( A885A9A91694FD3900CA6E1B /* TimesSquare.xcodeproj */, A885A9761694FCDD00CA6E1B /* UIKit.framework */, A885A9781694FCDD00CA6E1B /* Foundation.framework */, A885A97A1694FCDD00CA6E1B /* CoreGraphics.framework */, A885A9941694FCDD00CA6E1B /* SenTestingKit.framework */, ); name = Frameworks; sourceTree = ""; }; A885A9741694FCDD00CA6E1B /* Products */ = { isa = PBXGroup; children = ( A885A9731694FCDD00CA6E1B /* TimesSquareTestApp.app */, A885A9931694FCDD00CA6E1B /* TimesSquareTestAppTests.octest */, ); name = Products; sourceTree = ""; }; A885A99A1694FCDD00CA6E1B /* Tests */ = { isa = PBXGroup; children = ( A885A9A01694FCDD00CA6E1B /* TimesSquareTestAppTests.h */, A885A9A11694FCDD00CA6E1B /* TimesSquareTestAppTests.m */, A885A99B1694FCDD00CA6E1B /* Supporting Files */, ); name = Tests; path = TimesSquareTestAppTests; sourceTree = ""; }; A885A99B1694FCDD00CA6E1B /* Supporting Files */ = { isa = PBXGroup; children = ( A885A99C1694FCDD00CA6E1B /* TimesSquareTestAppTests-Info.plist */, A885A99D1694FCDD00CA6E1B /* InfoPlist.strings */, ); name = "Supporting Files"; sourceTree = ""; }; A885A9AA1694FD3900CA6E1B /* Products */ = { isa = PBXGroup; children = ( A885A9B21694FD3900CA6E1B /* libTimesSquare.a */, ); name = Products; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ A885A9721694FCDD00CA6E1B /* TimesSquareTestApp */ = { isa = PBXNativeTarget; buildConfigurationList = A885A9A31694FCDD00CA6E1B /* Build configuration list for PBXNativeTarget "TimesSquareTestApp" */; buildPhases = ( A885A96F1694FCDD00CA6E1B /* Sources */, A885A9701694FCDD00CA6E1B /* Frameworks */, A885A9711694FCDD00CA6E1B /* Resources */, ); buildRules = ( ); dependencies = ( A885A9B41694FD4700CA6E1B /* PBXTargetDependency */, ); name = TimesSquareTestApp; productName = TimesSquareTestApp; productReference = A885A9731694FCDD00CA6E1B /* TimesSquareTestApp.app */; productType = "com.apple.product-type.application"; }; A885A9921694FCDD00CA6E1B /* TimesSquareTestAppTests */ = { isa = PBXNativeTarget; buildConfigurationList = A885A9A61694FCDD00CA6E1B /* Build configuration list for PBXNativeTarget "TimesSquareTestAppTests" */; buildPhases = ( A885A98E1694FCDD00CA6E1B /* Sources */, A885A98F1694FCDD00CA6E1B /* Frameworks */, A885A9901694FCDD00CA6E1B /* Resources */, A885A9911694FCDD00CA6E1B /* ShellScript */, ); buildRules = ( ); dependencies = ( A885A9991694FCDD00CA6E1B /* PBXTargetDependency */, ); name = TimesSquareTestAppTests; productName = TimesSquareTestAppTests; productReference = A885A9931694FCDD00CA6E1B /* TimesSquareTestAppTests.octest */; productType = "com.apple.product-type.bundle"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ A885A9481694FC4500CA6E1B /* Project object */ = { isa = PBXProject; attributes = { LastTestingUpgradeCheck = 0510; LastUpgradeCheck = 0510; }; buildConfigurationList = A885A94B1694FC4500CA6E1B /* Build configuration list for PBXProject "TimesSquareTestApp" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = A885A9461694FC4500CA6E1B; productRefGroup = A885A9741694FCDD00CA6E1B /* Products */; projectDirPath = ""; projectReferences = ( { ProductGroup = A885A9AA1694FD3900CA6E1B /* Products */; ProjectRef = A885A9A91694FD3900CA6E1B /* TimesSquare.xcodeproj */; }, ); projectRoot = ""; targets = ( A885A9721694FCDD00CA6E1B /* TimesSquareTestApp */, A885A9921694FCDD00CA6E1B /* TimesSquareTestAppTests */, ); }; /* End PBXProject section */ /* Begin PBXReferenceProxy section */ A885A9B21694FD3900CA6E1B /* libTimesSquare.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = libTimesSquare.a; remoteRef = A885A9B11694FD3900CA6E1B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXReferenceProxy section */ /* Begin PBXResourcesBuildPhase section */ A885A9711694FCDD00CA6E1B /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( A885A9BB1694FDE000CA6E1B /* CalendarPreviousMonth.png in Resources */, A885A9BC1694FDE000CA6E1B /* CalendarPreviousMonth@2x.png in Resources */, A885A9BD1694FDE000CA6E1B /* CalendarRow.png in Resources */, A885A9BE1694FDE000CA6E1B /* CalendarRow@2x.png in Resources */, A885A9BF1694FDE000CA6E1B /* CalendarRowBottom.png in Resources */, A885A9C01694FDE000CA6E1B /* CalendarRowBottom@2x.png in Resources */, A885A9C11694FDE000CA6E1B /* CalendarSelectedDate.png in Resources */, A885A9C21694FDE000CA6E1B /* CalendarSelectedDate@2x.png in Resources */, A885A9C31694FDE000CA6E1B /* CalendarTodaysDate.png in Resources */, A885A9C41694FDE000CA6E1B /* CalendarTodaysDate@2x.png in Resources */, A885A9C51694FDE000CA6E1B /* Default-568h@2x.png in Resources */, A885A9C61694FDE000CA6E1B /* Default.png in Resources */, A885A9C71694FDE000CA6E1B /* Default@2x.png in Resources */, A885A9C81694FDE400CA6E1B /* InfoPlist.strings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; A885A9901694FCDD00CA6E1B /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( A885A99F1694FCDD00CA6E1B /* InfoPlist.strings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ A885A9911694FCDD00CA6E1B /* ShellScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ A885A96F1694FCDD00CA6E1B /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( A885A9B61694FD5400CA6E1B /* TSQTAAppDelegate.m in Sources */, A885A9B81694FD5400CA6E1B /* TSQTACalendarRowCell.m in Sources */, A885A9BA1694FD5400CA6E1B /* TSQTAViewController.m in Sources */, A885AA841695023500CA6E1B /* main.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; A885A98E1694FCDD00CA6E1B /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( A885A9A21694FCDD00CA6E1B /* TimesSquareTestAppTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ A885A9991694FCDD00CA6E1B /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = A885A9721694FCDD00CA6E1B /* TimesSquareTestApp */; targetProxy = A885A9981694FCDD00CA6E1B /* PBXContainerItemProxy */; }; A885A9B41694FD4700CA6E1B /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = TimesSquare; targetProxy = A885A9B31694FD4700CA6E1B /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ A885A9621694FC8A00CA6E1B /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( A885A9631694FC8A00CA6E1B /* en */, ); name = InfoPlist.strings; path = en.lproj; sourceTree = ""; }; A885A99D1694FCDD00CA6E1B /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( A885A99E1694FCDD00CA6E1B /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ A885A94D1694FC4500CA6E1B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ONLY_ACTIVE_ARCH = YES; }; name = Debug; }; A885A94E1694FC4500CA6E1B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { }; name = Release; }; A885A9A41694FCDD00CA6E1B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Developer/Library/Frameworks\"", ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "TimesSquareTestApp-Prefix.pch"; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_FILE = "$(SRCROOT)/TimesSquareTestApp-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 5.0; ONLY_ACTIVE_ARCH = YES; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; WRAPPER_EXTENSION = app; }; name = Debug; }; A885A9A51694FCDD00CA6E1B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Developer/Library/Frameworks\"", ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "TimesSquareTestApp-Prefix.pch"; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_FILE = "$(SRCROOT)/TimesSquareTestApp-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 5.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; }; name = Release; }; A885A9A71694FCDD00CA6E1B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/TimesSquareTestApp.app/TimesSquareTestApp"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; FRAMEWORK_SEARCH_PATHS = ( "\"$(SDKROOT)/Developer/Library/Frameworks\"", "\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"", ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "TimesSquareTestApp/TimesSquareTestApp-Prefix.pch"; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_FILE = "TimesSquareTestAppTests/TimesSquareTestAppTests-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 6.0; ONLY_ACTIVE_ARCH = YES; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; TEST_HOST = "$(BUNDLE_LOADER)"; WRAPPER_EXTENSION = octest; }; name = Debug; }; A885A9A81694FCDD00CA6E1B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/TimesSquareTestApp.app/TimesSquareTestApp"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; FRAMEWORK_SEARCH_PATHS = ( "\"$(SDKROOT)/Developer/Library/Frameworks\"", "\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"", ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "TimesSquareTestApp/TimesSquareTestApp-Prefix.pch"; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_FILE = "TimesSquareTestAppTests/TimesSquareTestAppTests-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 6.0; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; TEST_HOST = "$(BUNDLE_LOADER)"; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = octest; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ A885A94B1694FC4500CA6E1B /* Build configuration list for PBXProject "TimesSquareTestApp" */ = { isa = XCConfigurationList; buildConfigurations = ( A885A94D1694FC4500CA6E1B /* Debug */, A885A94E1694FC4500CA6E1B /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; A885A9A31694FCDD00CA6E1B /* Build configuration list for PBXNativeTarget "TimesSquareTestApp" */ = { isa = XCConfigurationList; buildConfigurations = ( A885A9A41694FCDD00CA6E1B /* Debug */, A885A9A51694FCDD00CA6E1B /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; A885A9A61694FCDD00CA6E1B /* Build configuration list for PBXNativeTarget "TimesSquareTestAppTests" */ = { isa = XCConfigurationList; buildConfigurations = ( A885A9A71694FCDD00CA6E1B /* Debug */, A885A9A81694FCDD00CA6E1B /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = A885A9481694FC4500CA6E1B /* Project object */; } ================================================ FILE: TimesSquareTestApp/TimesSquareTestApp.xcodeproj/xcshareddata/xcschemes/TimesSquareTestApp.xcscheme ================================================ ================================================ FILE: TimesSquareTestApp/TimesSquareTestAppTests/TimesSquareTestAppTests-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier com.squareup.${PRODUCT_NAME:rfc1034identifier} CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType BNDL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 ================================================ FILE: TimesSquareTestApp/TimesSquareTestAppTests/TimesSquareTestAppTests.h ================================================ // // TimesSquareTestAppTests.h // TimesSquareTestAppTests // // Created by Jim Puls on 1/2/13. // // #import @interface TimesSquareTestAppTests : SenTestCase @end ================================================ FILE: TimesSquareTestApp/TimesSquareTestAppTests/TimesSquareTestAppTests.m ================================================ // // TimesSquareTestAppTests.m // TimesSquareTestAppTests // // Created by Jim Puls on 1/2/13. // // #import "TimesSquareTestAppTests.h" @implementation TimesSquareTestAppTests - (void)setUp { [super setUp]; // Set-up code here. } - (void)tearDown { // Tear-down code here. [super tearDown]; } - (void)testExample { STFail(@"Unit tests are not implemented yet in TimesSquareTestAppTests"); } @end ================================================ FILE: TimesSquareTestApp/TimesSquareTestAppTests/en.lproj/InfoPlist.strings ================================================ /* Localized versions of Info.plist keys */ ================================================ FILE: TimesSquareTestApp/en.lproj/InfoPlist.strings ================================================ /* Localized versions of Info.plist keys */ ================================================ FILE: TimesSquareTestApp/main.m ================================================ // // main.m // TimesSquareTestApp // // Created by Jim Puls on 12/5/12. // Licensed to Square, Inc. under one or more contributor license agreements. // See the LICENSE file distributed with this work for the terms under // which Square, Inc. licenses this file to you. #import #import "TSQTAAppDelegate.h" int main(int argc, char *argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([TSQTAAppDelegate class])); } }