Last active
September 17, 2015 18:16
-
-
Save jungchris/d9afd93cf333a78f363f to your computer and use it in GitHub Desktop.
Sessions Table Filtered both by Date and Track
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is the .h file | |
// properties set by previous view controllers DatesTableVC or TracksTableVC | |
@property (assign, nonatomic) NSInteger selectedRow; | |
@property (nonatomic, strong) NSDate *selectedDate; | |
@property (nonatomic, strong) NSString *selectedTrack; | |
// --------------------------------------------------------------------------------------------- | |
// this is the .m file | |
@interface SessionTableVC () | |
// this is used to display the filtered by date and/or track sessions | |
@property (nonatomic, strong) NSArray *filteredArray; | |
// used to set local notifications | |
@property (nonatomic, strong) NSDate *startDate; | |
@property (nonatomic, strong) NSDate *endDate; | |
@property (nonatomic, strong) NSString *sessionTitle; | |
// used to add/remove sessions | |
@property (nonatomic, assign) NSInteger selectedSessionId; | |
// used to provide info to iOS 7 Alert delegate | |
@property (nonatomic, strong) NSNumber *conflictingSessionId; | |
// use previous table view selections to filter the sessions array for specific dates | |
- (void)createFilteredArray { | |
if (self.selectedDate) { | |
// NSLog(@"self.selectedDate"); | |
// Store result in a temp directory for further filtering by track | |
NSArray *tempArray = [SharedConferenceObject filterSessionsByDate:self.selectedDate]; | |
// further filtering | |
if (self.selectedTrack) { | |
// NSLog(@"selectedTrack"); | |
self.filteredArray = [ConferenceModel filterArray:tempArray byTrack:self.selectedTrack]; | |
} else { | |
// NSLog(@"NOT selectedTrack"); | |
self.filteredArray = tempArray; | |
} | |
} else { | |
if (self.selectedTrack) { | |
// NSLog(@"selectedTrack"); | |
self.filteredArray = [ConferenceModel filterArray:SharedConferenceObject.sessionsArray byTrack:self.selectedTrack]; | |
} else { | |
// default no filtering | |
// NSLog(@"DEFAULT: NOT self.selectedTrack"); | |
self.filteredArray = SharedConferenceObject.sessionsArray; | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment