Created
October 21, 2010 18:18
-
-
Save ronnieV3/639006 to your computer and use it in GitHub Desktop.
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
//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