I am creating an app that takes information from a plist to create an electronic catalogue. We have many different versions, and it would be nice if I didn’t have to go into the code for each app and set this number of sections for each one, and every time we make an update.
I want to use a do while loop to accomplish this, but can’t figure out how to rename my instance for each one. Please see the attached code, any help would be greatly appreciated!
scroller = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 44, 320, 387)];
int secNum = 8;
int secTemp = 0;
int frameWidth = self.view.frame.size.width;
int frameHeight = self.view.frame.size.height;
do {
id *sectionViewController = [NSString stringWithFormat:@"svc%d",secTemp];
SectionViewController *sectionViewController = [[SectionViewController alloc] init];
[sectionViewTable setDataSource:sectionViewController];
[sectionViewTable setDelegate:sectionViewController];
sectionViewController.view = sectionViewController.tableView;
sectionViewController.view.frame = CGRectMake(frameWidth*secTemp, 0, frameWidth, frameHeight);
secTemp = secTemp + 1;
[scroller addSubview:sectionViewController.view];
} while (secTemp < secNum);
scroller.contentSize = CGSizeMake(320*secTemp, 387);
scroller.pagingEnabled = YES;
I can’t figure out the rest, and have found nothing online to help myself. Thanks!
Cant really get your question… you want the sectionViewController to have another name for every cycle to access it?
Why don’t you create an NSMutableArray and add the instances of your sectionViewController to it? So you can receive it via index.
Or did I get your question wrong?