Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3486774
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:04:14+00:00 2026-05-18T11:04:14+00:00

I am now using this code: – (void)loadLauncher:(NSMutableArray *)categoriesArray { _launcherView = [[TTLauncherView alloc]

  • 0

I am now using this code:

- (void)loadLauncher:(NSMutableArray *)categoriesArray {
    _launcherView = [[TTLauncherView alloc] initWithFrame:self.view.bounds];
    _launcherView.columnCount = 3;

    // Number of pages in your launcherView.
    NSMutableArray *pages = [[NSMutableArray alloc] initWithCapacity:2];

    int numberOfObjects = [categoriesArray count];

    // The launcherItems in each page, calculate automatically the number of objects available for the launcher.
    NSMutableArray *launcherItems = [[NSMutableArray alloc] initWithCapacity:1];

    // The counter to identify if the number of objects exceeds the,
    // capacity of a launcher page of 9.
    int j = 1;

    for (int i = 0; i < numberOfObjects; i++){  
        if (j > 9){
            // Add the current launcherItems array to the pages.
            [pages addObject:launcherItems];

            // Initialise new launcher items.
            launcherItems = [[NSMutableArray alloc] initWithCapacity:1];

            // Start the counter again.
            j = 1;
        } else {  
            int i = 0;
            for (Category *c in categoriesArray) {
                NSString *categoryImage = [[NSString stringWithFormat:@"bundle://category_%@_icon.png", [Utility removeSpecialCharacters:@"&'- " withString:c.categoryName]] lowercaseString];
                NSLog(@" - %@", categoryImage);
                TTLauncherItem *launcherItem = [[[TTLauncherItem alloc] initWithTitle:c.categoryName
                                                                                image:categoryImage
                                                                                  URL:[NSString stringWithFormat:@"%d", i]
                                                                            canDelete:NO] autorelease];

                [launcherItems addObject:launcherItem];         

                i++;
            }
        }

        j++;
    }

    // Add the current launcherItems to the pages.
    [pages addObject:launcherItems];
    [launcherItems release];

    _launcherView.pages = pages;

    [self.view addSubview:_launcherView];
}

Old method:

I am using the TTLauncherView controller from http://three20.info.

Three20 is a collection of Objective-C classes that powers a growing number of popular applications on the App Store. It provides dozens of incredibly useful features that save you development time.

The library is built to be modular, which means you can selectively incorporate elements of the library into your project. There is also a growing set of extensions including drop-in XML and JSON parsing, as well as CSS stylesheet support for theming your applications.

I am not quite sure how to do the following:

  1. Check whether my arrayOfLauncherItems has 16 objects in it; and
  2. If there are more than 16 objects, add the rest of the remaining objects to _launcherView.pages. So if let’s say there’s a total of 32 objects I’d want to be able to create another array of the remaining 16 objects and add them to the _launcherView.pages NSArray.

This is an example of how the TTLauncherView controller works:

TTLauncherView *_launcherView = [[TTLauncherView alloc] initWithFrame:self.view.bounds];

NSMutableArray *arrayOfLauncherItems = [[NSMutableArray alloc] init];
//add TTLauncherItem objects to arrayOfLauncherItems.

_launcherView.pages = [NSArray arrayWithObjects:arrayOfLauncherItems, nil];

The arrayOfLauncherItems may contain more than 16 objects, which means that the remaining TTLauncherItem objects should be on the second page and so forth (depending on how many total objects there are).

Doing the following obviously adds the same 16 objects from arrayOfLauncherItems, which means that there’s now a second page, which is essentially what I want to achieve if there’s more than 32 objects in arrayOfLauncherItems.

_launcherView.pages = [NSArray arrayWithObjects:arrayOfLauncherItems, arrayOfLauncherItems, nil];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T11:04:15+00:00Added an answer on May 18, 2026 at 11:04 am

    I have the following code that you may want to use. Basic idea is to calculate automatically the number of pages based on the number of objects available. I assume that you have 3×3=9 launcher items in each page. In this way, you don’t have to worry about the total number of objects less than or greater than 9. You can put this value in a constant if you want.

    NSMutableArray *pages = [NSMutableArray array];
    NSMutableArray *launcherItems = [NSMutableArray array];
    
    //the counter to identify if the number of objects exceeds the
    //capacity of a launcher page of 9
    int j = 1;
    for (int i = 0; i < numberOfObjects; i++){  
    
        TTLauncherItem *launcherItem = [[[TTLauncherItem alloc] initWithTitle: @"a title" 
                                                                        image: @"bundle://abc.png"
                                                                          URL: @"someUrlPath"
                                                                    canDelete:TRUE] autorelease];
        [launcherItems addObject:launcherItem];         
    
        j++;
    
        if (j> 9){
            //add the current launcherItems to the pages
            [pages addObject:launcherItems];
    
            //initialize new launcher items
            launcherItems = [NSMutableArray array];
            //start again the counter
            j = 1;
        }       
    }
    //add the current launcherItems to the pages
    [pages addObject:launcherItems];
    
    _launcherView.pages = pages;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now I'm using this code to get the size of a folder: NSArray
Right now I am using this code: string url = http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=hey&esrch=FT1; string source =
Right now I am using this code to download files (with a Range header).
Right now I am using this code Calendar cal = Calendar.getInstance(); SimpleDateFormat sdf =
As of right now I'm using this code below to download files to get
Right now I am using this to export a repeater (with multiple nested repeaters)
ADDED: This question is now, I believe, subsumed by this one: Using GNU Screen
I'm using markdown to edit this question right now. In some wikis I used
I'm always surprised that even after using C# for all this time now, I
I'm using TinyXML to parse/build XML files. Now, according to the documentation this library

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.