Skip to content

Instantly share code, notes, and snippets.

(
{
maxEventStartTime = "2014-04-30 17:00:00 +0000";
minEventStartTime = "2014-04-30 17:00:00 +0000";
startDay = "2014-04-30 04:00:00 +0000";
},
{
maxEventStartTime = "2014-05-01 14:00:00 +0000";
minEventStartTime = "2014-05-01 04:00:00 +0000";
startDay = "2014-05-01 04:00:00 +0000";
@adamgall
adamgall / fetchEventDays.m
Created May 7, 2014 17:53
fetchEventDays
- (void)fetchEventDays
{
NSExpression *startDateTimeExpression = [NSExpression expressionForKeyPath:@"startDateTime"];
NSExpression *minStartDateTime = [NSExpression expressionForFunction:@"min:" arguments:[NSArray arrayWithObject:startDateTimeExpression]];
NSExpression *maxStartDateTime = [NSExpression expressionForFunction:@"max:" arguments:[NSArray arrayWithObject:startDateTimeExpression]];
NSExpressionDescription *minStartDateTimeExpression = [[NSExpressionDescription alloc] init];
minStartDateTimeExpression.name = @"minEventStartTime";
minStartDateTimeExpression.expression = minStartDateTime;
minStartDateTimeExpression.expressionResultType = NSDateAttributeType;
@interface NIAgendaDetailViewController ()
@property (nonatomic, weak) IBOutlet UITableView *table;
@property (nonatomic, strong) NIAgendaDetailMainCell *mainCellTemplate;
@end
@implementation NIAgendaDetailViewController
- (void)viewDidLoad
// the long text that needs to fit in the label
static NSString *longText = @"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum aliquet ornare quam vitae pulvinar. Vestibulum dapibus posuere facilisis. Maecenas iaculis nibh eu felis accumsan, id blandit metus congue!!!";
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row == 0) {
NIAgendaDetailMainCell *cell = [tableView dequeueReusableCellWithIdentifier:@"agendaDetailMainCell" forIndexPath:indexPath];
cell.lblNotes.text = longText;
return cell;
} else {
#pragma mark - Gesture delegates
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
return [self.scheduleDelegate shouldHaveDropdown];
}
// NIScheduleBaseViewController.h
@interface NIScheduleBaseViewController : UIViewController <ScheduleNavigationDelegate>
@end
// NIScheduleBaseViewController.m
@implementation NIScheduleBaseViewController
- (void)viewDidLoad
{
@interface NIScheduleNavigationDropdown : UIView
@property (nonatomic, weak) IBOutlet UIView *containerView;
@property (nonatomic, weak) IBOutlet UILabel *lblAgenda;
@property (nonatomic, weak) IBOutlet UILabel *lblMonth;
@property (nonatomic, weak) IBOutlet UILabel *lblYear;
- (void)setHighlightedItem:(NSString *)screen;
@end
// NINavigationBar.h
@protocol ScheduleNavigationDelegate
- (NSString *)getScheduleScreenIdentifier;
@end
@interface NINavigationBarSchedule : UINavigationBar
@property (nonatomic, strong) id<ScheduleNavigationDelegate> scheduleDelegate;