Skip to content

Instantly share code, notes, and snippets.

@ronnieV3
Created October 21, 2010 18:18
Show Gist options
  • Save ronnieV3/639006 to your computer and use it in GitHub Desktop.
Save ronnieV3/639006 to your computer and use it in GitHub Desktop.
//static consts from static class
static const int kSection1 = 0;
static const int kSection2 = 1;
static const int kSection3 = 2;
static const int kSection4 = 3;
//call to below function
NSDictionary * pageData = [[dataModel sharedInstance] getPageDataFromArray:kSection1 atIndex:0];
///function in my dataModel class to be called elsewhere
-(id)getPageDataFromArray:(int)sectionName atIndex:(int)nIndex
{
switch (sectionName) {
case kSection1:
if (!educationArray) {
educationArray = [[NSArray alloc] initWithObjects:
[NSDictionary dictionaryWithObjectsAndKeys:
@"education_main_image_1.png", @"mainImageName",
@"education_main_title_1.png", @"mainTitleName",
@"education_main_body_1.png", @"mainBodyName",
nil],
[NSDictionary dictionaryWithObjectsAndKeys:
@"education_main_image_2.png", @"mainImageName",
@"education_main_title_2.png", @"mainTitleName",
@"education_main_body_2.png", @"mainBodyName",
nil],
nil];
}
return [educationArray objectAtIndex:nIndex];
break;
case kSection2:
if (!overviewArray) {
overviewArray = [[NSArray alloc] initWithObjects:
[NSDictionary dictionaryWithObjectsAndKeys:
@"education_main_image_2.png", @"mainImageName",
@"education_main_title_2.png", @"mainTitleName",
@"education_main_body_2.png", @"mainBodyName",
nil],
[NSDictionary dictionaryWithObjectsAndKeys:
@"education_main_image_1.png", @"mainImageName",
@"education_main_title_1.png", @"mainTitleName",
@"education_main_body_1.png", @"mainBodyName",
nil],
nil];
}
return [overviewArray objectAtIndex:nIndex];
break;
default:
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment