Creating multiple instances of a class in do-while loop iOS

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!

Answers


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?


Need Your Help

Detect text in textbox even when pagesource shows textbox previous value

javascript c# html asp.net

My question is very simple if the DOM does not have a textbox value which user types how does javascript detect the latest text typed by the user in the browser

AS - WHERE not working

mysql

SELECT *,(SELECT count(*) FROM resimler WHERE ilanId=ilanlar.Id) AS

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.