Skip to content

Instantly share code, notes, and snippets.

// NINavigationBar.h
@protocol ScheduleNavigationDelegate
- (NSString *)getScheduleScreenIdentifier;
@end
@interface NINavigationBarSchedule : UINavigationBar
@property (nonatomic, strong) id<ScheduleNavigationDelegate> scheduleDelegate;
@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
// NIScheduleBaseViewController.h
@interface NIScheduleBaseViewController : UIViewController <ScheduleNavigationDelegate>
@end
// NIScheduleBaseViewController.m
@implementation NIScheduleBaseViewController
- (void)viewDidLoad
{
#pragma mark - Gesture delegates
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
return [self.scheduleDelegate shouldHaveDropdown];
}
// 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 {
@interface NIAgendaDetailViewController ()
@property (nonatomic, weak) IBOutlet UITableView *table;
@property (nonatomic, strong) NIAgendaDetailMainCell *mainCellTemplate;
@end
@implementation NIAgendaDetailViewController
- (void)viewDidLoad
@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;
(
{
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 / entityObject
Last active August 29, 2015 14:01
Entity
{
startDay: 2014-05-17 00:00:00.000,
startDateTime: 2014-05-17 08:30:00.000
},
{
startDay: 2014-05-17 00:00:00.000,
startDateTime: 2014-05-17 17:00:00.000
},
{
startDay: 2014-05-18 00:00:00.000,
@adamgall
adamgall / pipeDreams
Created May 7, 2014 18:07
what I want
(
{
morningEvent = YES;
eveningEvent = YES;
startDay = "2014-05-27 04:00:00 +0000";
},
{
morningEvent = NO;
eveningEvent = YES;
startDay = "2014-05-28 04:00:00 +0000";