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
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
// NSLog(@"Sponsor #: %li", (long)self.selectedRow); | |
// set view | |
NSInteger orgIndex = [SharedConferenceObject indexOfIdInOrganzationsArray:[NSNumber numberWithInteger:self.selectedRow]]; | |
if ((NSNotFound == orgIndex) || (orgIndex >= [SharedConferenceObject.organizationsArray count])) { | |
// there's a problem ... | |
NSLog(@"CATCH: SponsorDetailVC array index notFound/bounds for selectedRow: %lu", (long)self.selectedRow); | |
} else { | |
// Everything's Ok, display everything wanted |
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
// used to determine correct location of object in array | |
- (NSInteger)indexOfIdInSessionsArray:(NSNumber*)inputNum { | |
// simple loop. Could use containsObject instead | |
for (NSInteger i = 0; i < [self.sessionsArray count]; i++) { | |
// check for NSNumber object equality | |
SessionsModel *session = self.sessionsArray[i]; | |
if ([session.sessionId isEqual:inputNum]) { | |
return i; | |
} | |
} |
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
NSString *notificationName = [CCJNotificationEngine notificationTargetRandomizer]; | |
NSString *notificationTitle; | |
if (notificationName) { | |
if (notificationName.length > 1) { | |
// NSString *uppercaseFirstLetter = [notificationName stringByReplacingCharactersInRange:NSMakeRange(0,1) | |
// withString:[[notificationName substringToIndex:1] capitalizedString]]; | |
// notificationTitle = [@"View" stringByAppendingString:uppercaseFirstLetter]; | |
notificationTitle = [self notificationTitleUsingNotificationName:notificationName]; |
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
+ (void)addLocalNotificationWithRepeatCount:(NSUInteger)repeatCountDesired startOffset:(NSUInteger)daysOffset { | |
// ask for permission if necessary | |
[CCJNotificationEngine requestPermissionToSetNotifications]; | |
// NSLog(@"notifications %@", [UIApplication sharedApplication].scheduledLocalNotifications ); | |
// let's set the time to 9:00 am | |
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | |
[dateFormatter setDateFormat:@"yyyy"]; |
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
// NOTES: sessionType property from JSON file 'sessions.json' compared to 'tracksString' from 'tracks.json' | |
// | |
// | |
@property (nonatomic, strong) NSString *selectedTrack; | |
@property (nonatomic, strong) NSArray *filteredArray; | |
@property (nonatomic, strong) NSArray *sortedArray; | |
@end | |
@implementation TracksTableVC |
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 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 delegate is executed before each rotation. Here we allow only one view to go to landscape | |
- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window | |
{ | |
// get the array of VCs from the nav controller | |
UINavigationController *navControl = (UINavigationController*)self.window.rootViewController; | |
NSArray *controllerArray = navControl.viewControllers; | |
NSUInteger controllerCount = [controllerArray count]; | |
// safety check, make sure we have at least one view controller on the stack | |
if (controllerCount > 0) { |
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
- (void)viewWillDisappear:(BOOL)animated { | |
[super viewWillDisappear:animated]; | |
// check if exiting | |
if (self.isMovingFromParentViewController) { | |
NSLog(@"isMovingFromParentViewController"); | |
// set public property to indicate this view will not longer be presented | |
self.isPresented = NO; | |
// forces a return to portrait orientation | |
NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait]; | |
[[UIDevice currentDevice] setValue:value forKey:@"orientation"]; |
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
#pragma mark - ISO8601 to NSDate & vice-versa | |
// Convert ISO 8601 standard Zulu date+time to NSDate | |
+ (NSDate*)convertISO8601ToNSDate:(NSString*)isoString { | |
NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; | |
[formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZ"]; | |
// Always use this locale when parsing fixed format date strings | |
NSLocale *posix = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]; | |
[formatter setLocale:posix]; |
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
// save array data | |
- (void)saveArrayData { | |
NSMutableDictionary *dataDict = [[NSMutableDictionary alloc] initWithCapacity:365]; | |
if (urgeArray != nil) { | |
[dataDict setObject:urgeArray forKey:@"events"]; // save the urges array | |
} | |
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
NSString *documentsDirectoryPath = [paths objectAtIndex:0]; |