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
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
// 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
- (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
// this method creates an index of the sponsors within organizations | |
- (void)createIndexOfSponsorsInOrganizations { | |
// sort first | |
[self createdSortedArrayOfSponsors]; | |
// prepare new mutable array | |
NSMutableArray *sponsors = [[NSMutableArray alloc] init]; | |
for (int i = 0; (i < [self.sortedArray count]); i++) { | |
// check each org and add those with organizationSposorLevel > 0 | |
int sponsorLevel = [self.sortedArray[i] organizationSponsorLevel]; | |
// add |
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
// Source: http://codewithchris.com/common-mistakes-with-adding-custom-fonts-to-your-ios-app/ | |
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
// iterate through all available fonts | |
for (NSString* family in [UIFont familyNames]) | |
{ | |
NSLog(@"%@", family); | |
for (NSString* name in [UIFont fontNamesForFamilyName: family]) | |
{ | |
NSLog(@" %@", name); |
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
// didUpdateToLocation is deprecated, replaced with didUpdateToLocations with an array | |
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations { | |
// code in case I need to get more than one location | |
int objCount = [locations count]; | |
NSLog(@"MapVC: Delegate: didUpdateLocationS - objects count = %u", objCount); | |
if (objCount > 1) { | |
CLLocation *oldLocation = [locations objectAtIndex:objCount - 1]; | |
NSLog(@"Prior location %f,%f", oldLocation.coordinate.latitude, oldLocation.coordinate.longitude); |
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
// Create array of Status Indicator UIButtons based on Andrew's 'configuredButton' method | |
- (void)defineStatusIndicatorButtons { | |
CGRect r = CGRectMake(0, 0, [[self.columnPlacementArray objectAtIndex:0] floatValue] + kButtonOffsetX, [[self.rowPlacementArray objectAtIndex:0] floatValue] + kButtonOffsetY); | |
self.arrayInfoButtons = [NSMutableArray arrayWithObjects: | |
(self.buttonStatusIndicatorPS = [self configuredStatusButton:r normalTitle:@"S" highlightTitle:@"possSm"]), | |
(self.buttonStatusIndicatorPM = [self configuredStatusButton:r normalTitle:@"M" highlightTitle:@"possMd"]), | |
(self.buttonStatusIndicatorPL = [self configuredStatusButton:r normalTitle:@"L" highlightTitle:@"possLg"]), | |
(self.buttonStatusIndicatorSS = [self configuredStatusButton:r normalTitle:@"S" highlightTitle:@"saleSm"]), | |
(self.buttonStatusIndicatorSM = [self configuredStatusButton:r normalTi |
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)postJSONToSlack { | |
// This is the URL to your Slack team and channel | |
NSMutableURLRequest *request = [NSMutableURLRequest | |
requestWithURL:[NSURL URLWithString:@"https://hooks.slack.com/services/YOUR_SLACK_WEBHOOK_ID_HERE"]]; | |
NSDictionary *requestData = [[NSDictionary alloc] initWithObjectsAndKeys: | |
@"Test post to NMDevs from iOS.\nSlack Webhook integration.", @"text", | |
nil]; | |
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)postJSONToSlack { | |
NSLog(@"Post JSON to Slack"); | |
// BuiltInNM #random | |
// NSMutableURLRequest *request = [NSMutableURLRequest | |
// requestWithURL:[NSURL URLWithString:@"https://hooks.slack.com/services/"]]; | |
// This is for NMDevs to #random | |
NSMutableURLRequest *request = [NSMutableURLRequest |